C# 全屏,隐藏任务栏

发布于 2024-11-08 05:14:21 字数 477 浏览 4 评论 0原文

我最近为我女儿编写了一个应用程序,这是一个无儿童区,她忽略了所有不必要的按键(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 技术交流群。

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

发布评论

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

评论(2

萌面超妹 2024-11-15 05:14:23

制作全屏应用程序的正确方法是在主窗体中放置类似 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.

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