private void MoveCursor()
{
// Set the Current cursor, move the cursor's Position,
// and set its clipping rectangle to the form.
this.Cursor = new Cursor(Cursor.Current.Handle);
Cursor.Position = new Point(Cursor.Position.X - 50, Cursor.Position.Y - 50);
Cursor.Clip = new Rectangle(this.Location, this.Size);
}
我使用上面的代码来限制运动,但我仍然能够将鼠标移动到窗体之外吗?限制鼠标移动只在指定的区域
我可以限制鼠标移动到表格指定的区域?请指教...
该代码仅在鼠标被控件捕获时才有效。请参阅[MSDN](https://msdn.microsoft.com/en-us/library/system.windows.forms.control.capture(v = vs.110).aspx)。 –