如何使 WinForms 应用程序全屏显示 [英] How do I make a WinForms app go Full Screen

查看:29
本文介绍了如何使 WinForms 应用程序全屏显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 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 应用程序全屏显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆