C#全屏显示,隐藏任务栏 [英] C# Fullscreen, hiding the taskbar

查看:324
本文介绍了C#全屏显示,隐藏任务栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近为我的女儿编写了一个应用程序,这是一个没有孩子的区域,在那里她忽略了所有不必要的按键操作(Windows键,Esc等),但是我遇到的问题是当我使用以下代码时:

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;

我可以隐藏任务栏,但它并未真正覆盖.当我将鼠标移到任务栏所在的位置并单击时,它也会弹出,同时使用此代码并在Windows窗体中运行外部应用程序,使该窗口窗体保持在顶部.

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.

如果任何人都可以通过适当的方式帮助我将Windows窗体显示为真正的全屏应用程序,并能够从窗体中运行外部应用程序并使它们在优先级上排在最前面,那将不胜感激.

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.

如果您错过了它,我正在使用VS2010,C#和winforms.

In case you missed it, I am using VS2010, C# and winforms.

提前谢谢!

推荐答案

制作全屏应用的正确方法是在主窗体中放入Bounds = Screen.PrimaryScreen.Bounds;之类的内容.然后,当您的应用程序获得焦点时,它将覆盖任务栏.

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.

您可能还想要FormBorderStyle = FormBorderStyle.None;

这篇关于C#全屏显示,隐藏任务栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆