Why is the dragdrop event never entered?
private void textBox1_DragDrop(object sender, DragEventArgs e)
{
Array a = (Array)e.Data.GetData(DataFormats.FileDrop);
e.Effect = DragDropEffects.All;
Debug.WriteLine("were in dragdrop");
}
private void textBox1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPr开发者_如何学Pythonesent(DataFormats.FileDrop, false) == true)
{
e.Effect = DragDropEffects.All;
}
}
Change the e.Effect assignment to DragDropEffects.Copy. Double-check that the event assignment is still there, click the lightning bolt icon in the Properties window. Sample code is available in this thread. Note that you can cast to string[] directly.
精彩评论