顯示具有 C# DragDrop 標籤的文章。 顯示所有文章
顯示具有 C# DragDrop 標籤的文章。 顯示所有文章

星期三, 5月 14, 2008

把檔案拖曳到視窗上

private void listBox1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
string[] s = (string[]) e.Data.GetData(DataFormats.FileDrop, false);
int i;
for(i = 0; i < s.Length; i++)
listBox1.Items.Add(s[i]);
}

//參考http://support.microsoft.com/kb/307966/en-us