界面锁鼠标[原创]

在项目中,需将鼠标锁定在主界面中,且鼠标不能跑到客显上去,于是有了下面的代码:
  1using System;
  2using System.Collections.Generic;
  3using System.Text;
  4
  5namespace convert
  6{
  7    class Class4
  8    {
  9        一个鼠标类

177        #endregion
178
179}

180

使用如下:
 1using System;
 2using System.Collections.Generic;
 3using System.Text;
 4using System.Windows.Forms;
 5
 6namespace convert
 7{
 8    public class loadform:ApplicationContext 
 9    {
10        public loadform()
11            :base()
12        {
13            Form5 ff = new Form5();      
14            
15            ff.Show();
16            Class4.Lock(ff);
17            Class4.Enable(ff);
18           
19        }

20    }

21}

22
注意,窗体须不能改变大小,可将窗体的FormBorderStyle 设置为None。

原文地址:https://www.cnblogs.com/winnxm/p/1072300.html