Hi Owe,
First of all, I would like to confirm my understanding of your issue.
From your description, I understand that when you do a drag drop from a
windows explorer folder onto the form, the Drag_Enter event will be fired
twice before the Drag_Drop fired.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.
I can not reproduce the problem, here is my reproduce code.(I tested on
windows xp+sp1, vs.net 2003)
<code snippet>
private void Form1_DragEnter(object sender,
System.Windows.Forms.DragEventArgs e)
{
if(e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect=DragDropEffects.All;
}
else
{
e.Effect=DragDropEffects.None;
}
System.Diagnostics.Debug.WriteLine("Form1_DragEnte r");
}
private void Form1_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)
{
string[] paths = (string[])e.Data.GetData("FileDrop",true);
if (paths.Length>0)
this.Text = paths[0];
System.Diagnostics.Debug.WriteLine("Form1_DragDrop ");
}
</code snippet>
You may try to create a new windows application and set the AllowDrop
property to true, and then add two event handlers, one is the dragenter,
the other is dragdrop.
Try to make a test to see if you can reproduce the problem, or can you
simplied your code to reproduce the problem and post here?
Or you may try to see if you have advised the dragenter event twice which
may cause the problem.
Please apply my suggestion above and let me know if it helps resolve your
problem.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.