You want to move the control by the amount of mouse movement:
Point mousePos; private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { mousePos = e.Location; } private void pictureBox1_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { int dx = eX - mousePos.X; int dy = eY - mousePos.Y; pictureBox1.Location = new Point(pictureBox1.Left + dx, pictureBox1.Top + dy); } }
Note that this code does not update the mousePos variable in MouseMove. Necessary because moving the control changes the relative position of the mouse cursor.
source share