2

为什么从不进入拖放事件?

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.GetDataPresent(DataFormats.FileDrop, false) == true)
    {
        e.Effect = DragDropEffects.All;
    }
}
4

1 回答 1

1

将 e.Effect 分配更改为 DragDropEffects.Copy。仔细检查事件分配是否仍然存在,单击“属性”窗口中的闪电图标。此线程中提供了示例代码。请注意,您可以直接转换为 string[]。

于 2010-08-19T13:12:35.397 回答