实现效果:
知识运用:
Cursor类中的相关属性
实现代码:
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) { this.Cursor = new Cursor(Cursor.Current.Handle); Screen[] screen = Screen.AllScreens; //获取显示的数组 Cursor.Clip= screen[0].Bounds; //解除活动区域的限制 }
原文地址:https://www.cnblogs.com/feiyucha/p/10284669.html
时间: 2024-10-02 20:42:37