C# 模拟软件键盘输入,使Winfrom窗体不获取鼠标焦点方法

方法一:

 1 private const int WS_EX_TOOLWINDOW = 0x00000080;
 2         private const int WS_EX_NOACTIVATE = 0x08000000;
 3 
 4         protected override CreateParams CreateParams
 5         {
 6             get
 7             {
 8                 CreateParams cp = base.CreateParams;
 9                 cp.ExStyle |= (WS_EX_NOACTIVATE | WS_EX_TOOLWINDOW);
10                 cp.Parent = IntPtr.Zero; // Keep this line only if you used UserControl
11                 return cp;
12 
13                 //return base.CreateParams;
14             }
15         } 

转载自:http://blog.sina.com.cn/s/blog_7744890b01019d19.html

posted @ 2020-01-10 01:29  forack  阅读(920)  评论(0编辑  收藏  举报