control.AllowDrop = True; //記得一定要開,否則下面程式都不會跑
private void control_DragDrop(object sender, DragEventArgs e)
{
string[] filePaths = (string[])(e.Data.GetData(DataFormats.FileDrop));
foreach (string fileLoc in filePaths)
{
}
}
private void control_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = DragDropEffects.Link;
}
else
{
e.Effect = DragDropEffects.None;
}
}
Drag and Drop Text Files from Windows Explorer to your Windows Form Application
Visual Basic 2005 – 如何拖放圖片 @ 章立民研究室
4.5托曳事件 - Happy VB開心農莊