Problem Description:
How to write code can implement the specified type of file by mouse drag and drop displayed in the program's text box, such as: Select 3 files (3 files formatted with MP3 and WMA) dragged to the program, the program's text box shows the path of these three files ...
Workaround Code:
This. Textbox1.allowdrop =true; This. Textbox1.multiline =true; Private voidTextbox1_dragdrop (Objectsender, DragEventArgs e) {Array Aryfiles=( (System.Array) e.data.getdata (DataFormats.FileDrop)); for(inti =0; i<aryfiles.length;i++) { This. Textbox1.appendtext (Aryfiles.getvalue (i). ToString () +Environment.NewLine); } } Private voidTextbox1_dragenter (Objectsender, DragEventArgs e) { if(E.data.getdatapresent (dataformats.filedrop)) E.effect=Dragdropeffects.link; ElseE.effect =DragDropEffects.None; }
C # File Drag and drop to this program's action