Point point = new Point(-10, -10);
bool mouseDown = false;
private void panelEx5_MouseDown(object sender, MouseEventArgs e)
{
mouseDown = true;
point = e.Location;
}
private void panelEx5_MouseMove(object sender, MouseEventArgs e)
{
if (mouseDown)
{
if (point != e.Location)
{
this.Location = new Point(this.Location.X + (e.Location.X - point.X), this.Location.Y + (e.Location.Y - point.Y));
Application.DoEvents();
}
}
}
private void panelEx5_MouseUp(object sender, MouseEventArgs e)
{
mouseDown = false;
this.Location = new Point(this.Location.X + (e.Location.X - point.X), this.Location.Y + (e.Location.Y - point.Y));
}