如何在任务栏顶部全屏显示 Windows 窗体? [英] How to display a Windows Form in full screen on top of the taskbar?

查看:33
本文介绍了如何在任务栏顶部全屏显示 Windows 窗体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要全屏运行的 .net windows 应用程序.然而,当应用程序启动时,任务栏显示在主窗体的顶部,只有在通过单击它或使用 ALT-TAB 激活窗体时它才会消失.表单的当前属性如下:

I have a .net windows application that needs to run in full screen. When the application starts however the taskbar is shown on top of the main form and it only disappears when activating the form by clicking on it or using ALT-TAB. The form's current properties are as follow:

  • WindowState=FormWindowState.Normal
  • TopMost=正常
  • Size=1024,768(这是将要运行的机器的屏幕分辨率)
  • FormBorderStyle = 无

我尝试在表单加载时添加以下内容,但没有一个对我有用:

I've tried adding the followings on form load but none worked for me:

  • this.Focus();(在赋予焦点后 this.Focus 属性始终为 false)
  • this.BringToFront();
  • this.TopMost = true;(但这在我的场景中并不理想)
  • this.Bounds = Screen.PrimaryScreen.Bounds;
  • this.Bounds = Screen.PrimaryScreen.Bounds;

有没有办法在 .NET 中做到这一点,或者我是否必须调用本机 Windows 方法,如果是这样,非常感谢代码片段.

Is there a way to do it within .NET or would I have to invoke native windows methods and if so a code snippet would very much be appreciated.

非常感谢

推荐答案

我的简单修复原来是调用表单的 Activate() 方法,因此无需使用 TopMost(这是我的目标).

My simple fix it turned out to be calling the form's Activate() method, so there's no need to use TopMost (which is what I was aiming at).

这篇关于如何在任务栏顶部全屏显示 Windows 窗体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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