鼠标活动区域限制
//限制鼠标活动区域 private void button1_Click(object sender, EventArgs e) { this.Cursor = new Cursor(Cursor.Current.Handle);//创建Cursor对象 Cursor.Position = new Point(Cursor.Position.X, Cursor.Position.Y);//设置鼠标位置 Cursor.Clip = new Rectangle(this.Location,this.Size);//设置鼠标活动区域 } //解除对鼠标活动区域的限制 private void button2_Click(object sender, EventArgs e) { Screen[] screens = Screen.AllScreens;//获取显示的数组 this.Cursor = new Cursor(Cursor.Current.Handle);//创建Cursor对象 Cursor.Clip = screens[0].Bounds;//解除对鼠标活动区域的限制 }