private bool drag;
private Point point;
private void label1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
drag = true;
point = new Point(e.X, e.Y);
}
else
{
drag = false;
}
}
private void label1_MouseMove(object sender, MouseEventArgs e)
{
if (drag)
{
Point poinMoveTo;
poinMoveTo = this.PointToScreen(new Point(e.X, e.Y));
poinMoveTo.Offset(-point.X, -point.Y);
this.Location = poinMoveTo;
}
} { drag = false; }
private void label1_MouseUp(object sender, MouseEventArgs e)
Output should be like this.
when you keep clicking on this label and you can move that form.

Join the conversation! Your thoughts help the community grow.