winform 用拖拉方式 上傳檔案

  1. 將Form的 AllowDrop 屬性設為 true
  2. 在 Form 的 DragEnter 事件中
  3. e.Effect = DragDropEffects.Copy;
  4. 在Form的 DragDrop 事件中

string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

MessageBox.Show(files[0].ToString());

 

by mhchen15 on 28 3 月, 2012 in Visual C#, 程式

There are no comments.

Name*: Website: E-Mail*:
XHTML: You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>