使我的应用程序“全屏”时,Windows 任务栏出现异常行为(WPF)
我正在开发一个具有全屏模式的应用程序。当按下全屏按钮/键时,应用程序应占据整个屏幕,即 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先尝试应用 WindowStyle(在 WindowState 之前)。这为我解决了。
编辑:我还注意到,当窗口已经最大化时,这不起作用。试试这个:
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:
而不是使用 WindowState
使用 SystemParameters
在窗口的构造函数中设置宽度和高度
您还可以查看 这里
Instead of using WindowState
use SystemParameters
In your Window's constructor set the width and height
You can also have a look here