【发布时间】:2011-01-17 08:08:25
【问题描述】:
我有一个需要全屏运行的 .net windows 应用程序。但是,当应用程序启动时,任务栏显示在主窗体的顶部,并且仅在通过单击它或使用 ALT-TAB 激活窗体时才会消失。表单的当前属性如下:
- WindowState=FormWindowState.Normal
- TopMost=正常
- Size=1024,768(这是运行它的机器的屏幕分辨率)
- FormBorderStyle = 无
我尝试在表单加载时添加以下内容,但没有一个对我有用:
- this.Focus(); (赋予焦点后 this.Focus 属性始终为 false)
- this.BringToFront();
- this.TopMost = true; (但这在我的场景中并不理想)
- this.Bounds = Screen.PrimaryScreen.Bounds;
- this.Bounds = Screen.PrimaryScreen.Bounds;
有没有办法在 .NET 中做到这一点,或者我必须调用本机 Windows 方法,如果是这样,非常感谢代码 sn-p。
非常感谢
【问题讨论】:
-
private void Form1_Activated(object sender, EventArgs e) { this.WindowState = FormWindowState.Maximized; }
标签: c# .net winforms fullscreen taskbar