Reputation: 63
I set two events in my code, Drag_Drop and Drag_Event, and everytime I try to drag something into the form, the 'circle with a line through it' symbol appears. Funny thing is, I used the same exact code in another project, and it worked perfectly. I registered the events and everything. Here is my code:
private void Form1_DragEnter(object sender, DragEventArgs e)
{
if (toSaveIcon)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = DragDropEffects.Copy;
}
}
}
private void Form1_DragDrop(object sender, DragEventArgs e)
{
if (toSaveIcon)
{
string[] filePath = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (string path in filePath)
{
icon = Icon.ExtractAssociatedIcon(path);
Debug.WriteLine("Icon saved successfully");
}
}
}
Upvotes: 0
Views: 52
Reputation: 45490
Funny thing is, I used the same exact code in another project, and it worked perfectly.
I had this issue before, I fixed it by running Visual Studio as a normal user. Make sure it is not running as an Administrator
if you are running from visual studio.
You can also run the app directly from the bin
folder , you will have a better idea.
Upvotes: 1