我正在使用C#WinForms创建覆盖。叠加层的大小必须与当前屏幕相同(或大于当前屏幕的大小)。但是,它不需要启用“聚焦辅助”功能。
我尝试使用FormWindowState.Maximized和P / Invoke MoveWindow,但是一旦窗体的大小与屏幕大小相同(或大于屏幕大小),就会启用焦点辅助。
这是我到目前为止的代码:
覆盖表单构造器
this.DoubleBuffered = true;
this.SetStyle(ControlStyles.OptimizedDoubleBuffer |
ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.SupportsTransparentBackColor, true);
SetWindowLong(this.Handle, GWL_EXSTYLE, (IntPtr)(GetWindowLong(this.Handle, GWL_EXSTYLE) | WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_NOACTIVATE));
SetLayeredWindowAttributes(this.Handle, 0, 128, LWA_ALPHA);
this.TopMost = true;
this.WindowState = FormWindowState.Maximized;
MoveWindow
Screen screen = Screen.FromPoint(Cursor.Position);
MoveWindow(this.Handle, screen.Bounds.X, screen.Bounds.Y, screen.Bounds.Width, screen.Bounds.Height, true);
如果有任何方法可以禁用此功能,我尚未找到它。任何想法将不胜感激。