使我的应用程序“全屏”时,Windows 任务栏出现异常行为(WPF)

发布于 2024-11-14 23:42:02 字数 477 浏览 4 评论 0原文

我正在开发一个具有全屏模式的应用程序。当按下全屏按钮/键时,应用程序应占据整个屏幕,即 Windows 任务栏也会消失。

this.Window= WindowState.Maximized;
this.Window= WindowStyle.None;
this.Fullscreen = true;

当我第一次启动应用程序时,我的全屏模式按计划工作,并且 Windows 任务栏消失。问题是当我调整窗口大小时。调整大小后,全屏模式不再占据整个屏幕。 Windows 任务栏仍然存在。对我来说禁用窗口大小调整是不合理的(尽管这确实解决了问题)。

据我了解,WindowStyle.None 删除了任务栏(一开始确实如此)。有谁知道调整窗口大小是否会改变某些内容,从而阻止 WindowStyle.None 执行首次启动时执行的操作。

编辑: 我正在使用视图框将内容缩放到全屏,并且全屏模式下视图框的拉伸设置为填充

I am working on an application that has a full screen mode. When the full screen button/key is pressed the application should take up the entire screen i.e. the windows taskbar also disappears.

this.Window= WindowState.Maximized;
this.Window= WindowStyle.None;
this.Fullscreen = true;

When I first start the application my fullscreen mode works as planned and the windows taskbar disappears. The problem is when I resize the window. After any resizing the full screen mode no longer takes up the entire screen. The windows taskbar is still there. It is not reasonable for me to disable window resizing (although that does solve the problem).

It was my understanding that WindowStyle.None removed the taskbar (it does at first). Does anyone know if resizing the window changes something that stops the WindowStyle.None from doing what it does upon first starting up.

EDIT:
I am using a viewbox to scale my content to fullscreen and the stretch of the viewbox in full screen mode is set to Fill

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

血之狂魔 2024-11-21 23:42:02

首先尝试应用 WindowStyle(在 WindowState 之前)。这为我解决了。

编辑:我还注意到,当窗口已经最大化时,这不起作用。试试这个:

this.WindowState = WindowState.Normal;
this.WindowStyle = WindowStyle.None;
this.WindowState = WindowState.Maximized;

Try applying the WindowStyle first (before WindowState). That fixed it for me.

Edit: I also noticed that this doesn't work when the window is already maximized. Try this:

this.WindowState = WindowState.Normal;
this.WindowStyle = WindowStyle.None;
this.WindowState = WindowState.Maximized;
2024-11-21 23:42:02

而不是使用 WindowState
使用 SystemParameters

在窗口的构造函数中设置宽度和高度

this.Width=SystemParameters.FullPrimaryScreenWidth;
this.Height=SystemParameters.FullPrimaryScreenHeight;

您还可以查看 这里

Instead of using WindowState
use SystemParameters

In your Window's constructor set the width and height

this.Width=SystemParameters.FullPrimaryScreenWidth;
this.Height=SystemParameters.FullPrimaryScreenHeight;

You can also have a look here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文