0
Reply

DragDrop Form Activation

Thomas Sieverding

Thomas Sieverding

May 18 2008 8:16 PM
2k
Pretty much, I want to make my controls so that you can drag them off of the form and it will launch a window containing my new form.

So... I was thinking

void Button1_MouseDown(object sender, MouseEventArgs e)
{
this.DragLeave += new EventHandler(Form1_DragLeave);
DoDragDrop(null, DragDropEffects.None);
}

void Form1_DragLeave(object sender, EventArgs e)
{
Application.Run(new Form2());
Form2.ActiveForm.SetDesktopLocation(MousePosition.X, MousePosition.Y);
}

However, DoDragDrop does not accept those arguments, so, thoughts on an alternative?