public Form1
{
InitializeComponent();
listBox1.AllowDrop = true;
listBox1.DragEnter += new DragEventHandler(listBox1_DragEnter);
listbox1.DragDrop += new DragEventHandler(listBox1_DragDrop);
}
private void listBox1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}
private void listBox1_DragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop, true))
{
string[] fileName = (string[])e.Data.GetData(DataFormats.FileDrop, true);
listBox1.Items.Add(fileName);
}
}