控件 AllowDrop属性改为true,并实现它的DragEnter、DragDrop这两个事件。
private void lbFilePath_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { e.Effect = DragDropEffects.All; } else { e.Effect = DragDropEffects.None; } } private void lbFilePath_DragDrop(object sender, DragEventArgs e) { string[] s=(string[])e.Data.GetData(DataFormats.FileDrop,false); for (int i = 0; i < s.Length; i++) { lbFilePath.Items.Add(s[i]); } }