Moving Control on MouseMove Event
-
Have a problem with moving a picturebox while left clicking and moving the mouse cursor:
private void pictureBox1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Left) { pictureBox1.Location = new Point(e.X,e.Y); } }
Looks not very nice during runtime, because there are some drawing problems. Any suggestions? -
Have a problem with moving a picturebox while left clicking and moving the mouse cursor:
private void pictureBox1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Left) { pictureBox1.Location = new Point(e.X,e.Y); } }
Looks not very nice during runtime, because there are some drawing problems. Any suggestions?Seraphin, To improve the looks during the draw you probably need to impliment double buffering. Take a look at this example: http://www.codeproject.com/cs/media/flickerFreeDrawing.asp It should get you going.