private bool Dragging = false; private Point start_point = new Point(0, 0); private void UserControlDesign_MouseDown(object sender, MouseEventArgs e) { Dragging = true; start_point = new Point(e.X, e.Y); } private void UserControlDesign_MouseUp(object sender, MouseEventArgs e) { Dragging = false; } private void UserControlDesign_MouseMove(object sender, MouseEventArgs e) { if (Dragging) { Point p1 = new Point(e.X, e.Y); Point p2 = this.FindForm().PointToScreen(p1); Point p3 = new Point(p2.X - start_point.X, p2.Y - start_point.Y); this.FindForm().Location = p3; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)