C# 全屏,隐藏任务栏
我最近为我女儿编写了一个应用程序,这是一个无儿童区,她忽略了所有不必要的按键(Windows 键、Esc 等),但我遇到的问题是,当我使用以下代码时:
targetForm.WindowState = FormWindowState.Maximized;
targetForm.FormBorderStyle = FormBorderStyle.None;
targetForm.TopMost = true;
我能够隐藏任务栏,但它并没有真正覆盖。当我将鼠标移动到任务栏所在的位置并单击时,它也会弹出,并且使用此代码并在我的窗口窗体中运行外部应用程序,我留下这个窗口窗体将其自身保持在顶部。
如果有人可以帮助我以正确的方式将我的 Windows 窗体显示为真正的全屏应用程序,并且能够从窗体内运行外部应用程序并使它们优先考虑,我将不胜感激。
如果你错过了,我正在使用 VS2010、C# 和 winforms。
提前致谢!
I have recently written an application for my daughter, which is a kid-free zone where she has all unnecessary key presses ignored (windows key, Esc etc) but the problem I am having is that when I use the following code:
targetForm.WindowState = FormWindowState.Maximized;
targetForm.FormBorderStyle = FormBorderStyle.None;
targetForm.TopMost = true;
I am able to HIDE the taskbar, but it is not truly overlayed. When I move the mouse to where the taskbar would be, and click, it pops up, also, using this code and running external applications withing my windows form, I am left with this windows form keeping itself on top.
If anyone could help me with a proper way to display my windows form as a true fullscreen application, and be able to run external applications from within the form and have them prioritize themselves on top, that would be greatly appreciated.
In case you missed it, I am using VS2010, C# and winforms.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
制作全屏应用程序的正确方法是在主窗体中放置类似
Bounds = Screen.PrimaryScreen.Bounds;
的内容。然后,当您的应用程序获得焦点时,它将覆盖任务栏。您可能还需要
FormBorderStyle = FormBorderStyle.None;
The proper way to make a full-screen app is to just put something like
Bounds = Screen.PrimaryScreen.Bounds;
in your main form. Then when your app has focus it will cover the task bar.You also probably want
FormBorderStyle = FormBorderStyle.None;
执行操作的顺序不正确。
您应该首先隐藏边框(FormBorderStyle=None),然后将窗口状态设置为最大化。您甚至不必将 TopMost 设置为 true。
The order of the performed actions is incorrect.
You should first hide the border (FormBorderStyle=None), and then set the window state to maximized. You even don't have to set TopMost to true.