이후 컨트롤의 DragOver 와 DragDrop 이벤트 핸들러를 작성.
// Drag & Drop private void OnFileDragDrop(object sender, DragEventArgs drgevent) { Console.WriteLine("Error in AppendData procedure."); //textFilePath.Text = "Drag Drop"; //base.OnDragDrop(drgevent); try { if (drgevent.Data.GetDataPresent(DataFormats.FileDrop, false)) { string[] fileNames = (string[])drgevent.Data.GetData(DataFormats.FileDrop); //foreach (string fileName in fileNames) { //파일 처리 pLogSession.sFilename = fileNames[0]; } } } catch (System.Exception ex) { //예외처리 Console.WriteLine(ex.Message); } } private void OnFileDragEnter(object sender, DragEventArgs e) { Console.WriteLine("Target Form Drag Enter"); e.Data.GetDataPresent(typeof(System.String)); //e.Effect = DragDropEffects.All; e.Effect = DragDropEffects.Copy; }
Designed by sketchbooks.co.kr / sketchbook5 board skin
Sketchbook5, 스케치북5
Sketchbook5, 스케치북5
Sketchbook5, 스케치북5
Sketchbook5, 스케치북5