Monday, 15 September 2014

c# - How to drag & drop only one file on form window -



c# - How to drag & drop only one file on form window -

i have 1 windows application in c#, want add together drag & drop facility in application, after adding facility takes multiple files, want take 1 file @ time, how this?

read code below , seek applying situation

public form1() { initializecomponent(); this.allowdrop = true; this.dragenter += form1_dragenter; this.dragdrop += 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) { var files = (string[])e.data.getdata(dataformats.filedrop); if (files.length == 1) { // want } else { // show error } }

c# .net winforms drag-and-drop

No comments:

Post a Comment