Hi !
I've got this strange problem :
When I press the left-button and move my mouse, my form moves just as
intended. But if I make big movements, the cursor shifts slightly. And
it ends with the mouse cursor completly out of the form, which is not
what I want, of course.
Here's the relevant snippet of my code :
private int lastX, lastY;
private void pictureBox_grip_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
this.lastX = MousePosition.X;
this.lastY = MousePosition.Y;
}
private void pictureBox_grip_MouseMove(object sender,
System.Windows.Forms.MouseEventArgs e)
{
if(this.pictureBox_grip.Capture)
{
this.Location = new Point(this.Location.X + MousePosition.X -
this.lastX, this.Location.Y + MousePosition.Y - this.lastY);
this.lastX = MousePosition.X;
this.lastY = MousePosition.Y;
}
}
I also tried to use (e.X,e.Y) instead of MousePosition but the result
is worse : the form flickers a lot and the cursor shifts at once.
What am I doing wrong ?
Any help would be appreciated... It's driving me mad.