如何让 WinForms 应用程序全屏显示

How do I make a WinForms app go Full Screen(如何让 WinForms 应用程序全屏显示)
本文介绍了如何让 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 应用程序全屏显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)