问题描述
我有一个 WinForms 应用程序,我正在尝试使其全屏显示(有点像 VS 在全屏模式下所做的).
I have a WinForms app that I am trying to make full screen (somewhat like what VS does in full screen mode).
目前我将 FormBorderStyle
设置为 None
并将 WindowState
设置为 Maximized
这给了我更多空间,但如果它是可见的,它不会覆盖任务栏.
Currently I am setting FormBorderStyle
to None
and WindowState
to Maximized
which gives me a little more space, but it doesn't cover over the taskbar if it is visible.
我还需要做什么才能使用该空间?
What do I need to do to use that space as well?
对于奖励积分,我可以做些什么来让我的 MenuStrip
自动隐藏以放弃该空间?
For bonus points, is there something I can do to make my MenuStrip
autohide to give up that space as well?
推荐答案
对于基本问题,以下将解决问题(隐藏任务栏)
To the base question, the following will do the trick (hiding the taskbar)
private void Form1_Load(object sender, EventArgs e)
{
this.TopMost = true;
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
}
但是,有趣的是,如果您交换最后两行,任务栏仍然可见.我认为这些动作的顺序很难用属性窗口控制.
But, interestingly, if you swap those last two lines the Taskbar remains visible. I think the sequence of these actions will be hard to control with the properties window.
这篇关于如何让 WinForms 应用程序全屏显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!