c# - How do I drag and drop files into an application? -


i've seen done in borland's turbo c++ environment, i'm not sure how go c# application i'm working on. there best practices or gotchas out for?

some sample code:

  public partial class form1 : form {     public form1() {       initializecomponent();       this.allowdrop = true;       this.dragenter += new drageventhandler(form1_dragenter);       this.dragdrop += new drageventhandler(form1_dragdrop);     }      void form1_dragenter(object sender, drageventargs e) {       if (e.data.getdatapresent(dataformats.filedrop)) e.effect = dragdropeffects.copy;     }      void form1_dragdrop(object sender, drageventargs e) {       string[] files = (string[])e.data.getdata(dataformats.filedrop);       foreach (string file in files) console.writeline(file);     }   } 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -