0
我嘗試的選項添加到我的應用程序拖動文件到我Listbox
而不是瀏覽到該文件夾,這是我嘗試:拖放文件到我的列表框
private void Form1_Load(object sender, EventArgs e)
{
listBoxFiles.AllowDrop = true;
listBoxFiles.DragDrop += listBoxFiles_DragDrop;
listBoxFiles.DragEnter += listBoxFiles_DragEnter;
}
private void listBoxFiles_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}
private void listBoxFiles_DragDrop(object sender, DragEventArgs e)
{
listBoxFiles.Items.Add(e.Data.ToString());
}
但代替完整的文件路徑e.Data.ToString()
return System.Windows.Forms.DataObject