Advertisement
RedFledio

NOT FOR YOU

Dec 15th, 2019
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1.  // Get the functions on first!
  2. private bool dragging = false;
  3.         private Point start_point = new Point(0, 0);
  4.  
  5.         private void panel1_Paint(object sender, PaintEventArgs e)
  6.         {
  7.  
  8.         }
  9.  
  10.         private void panel1_MouseDown(object sender, MouseEventArgs e)
  11.         {
  12.  
  13.             dragging = true;
  14.             start_point = new Point(e.X, e.Y);
  15.         }
  16.  
  17.         private void panel1_MouseUp(object sender, MouseEventArgs e)
  18.         {
  19.             dragging = false;
  20.         }
  21.  
  22.         private void panel1_MouseMove(object sender, MouseEventArgs e)
  23.         {
  24.             if (dragging)
  25.             {
  26.                 Point p = PointToScreen(e.Location);
  27.                 Location = new Point(p.X - this.start_point.X, p.Y - this.start_point.Y);
  28.             }
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement