I have a WinForm application, I’m trying to move a pictureBox in a Form using MouseMove Event, but i can’t figure out what’s the right calculation should i do on MouseMove, when i first the pictureBox , its location changes in a senseless way then on moving the pictureBox Location moves correctly.
It’s a Panel name OuterPanel which contains the pictureBox picBox, here the code im using :
private void picBox_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Point p = OuterPanel.PointToClient(MousePosition);
picBox.Location = this.PointToClient(p);
}
}
P.S : the goal is moving image after zooming in, like windows photo viewer

Update : ConvertFromChildToForm method
private Point ConvertFromChildToForm(int x, int y,Control control)
{
Point p = new Point(x, y);
control.Location = p;
return p;
}
You have to Manage three Events to get it done correctly :
MouseDownMouseMoveMouseUpHere is a Related SO Question..
Your Code for
picBox:ConvertFromChildToFormmethod fromMur Haf Soz