Hide the taskbar using C#

こ雲淡風輕ζ 提交于 2019-12-17 21:08:44

问题


I am running Windows XP 64 bit. I want to hide the taskbar when I run my application.

I tried codes by searching the web. In all those, it hides the task bar. But the problem is, when i open a notepad and maximize it, it is not actually into full screen. Because the space where task bar was there is still blocked with empty space. I want it fit really into full screen mode.


回答1:


I've done this by making the application borderless, maximized, and setting it to be Topmost. Here's a perfect example from CodeProject.

As one of the commenters has said, replacing disabling Explorer and running your application might be the best way, security-wise.




回答2:


If you like to replace the windows shell (taskbar) you'll have to change a registry key.

Changing the default shell (all users):

  1. open regedit (start menu > run, and type in regedit)
  2. go to: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon.
  3. Change Shell from explorer.exe to your program path and name e.g. c:\myKioskApp\Kiosk.exe

Changing the default shell (only current user):

  1. open regedit (start menu > run, and type in regedit).
  2. go to: HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon.
  3. add a new string value (Edit > New > String Value) called shell. and set the value to the path of the new shell e.g. c:\myKioskApp\Kiosk.exe
  4. log out and log back in.



回答3:


You Can Hide your task bar by setting Following Properties of your C# Form.

WindowState : Maximized FormBorderStyle : FixedDialog




回答4:


on window 7 (or maybe higher) using FormWindowState.Maximized is wrong because the maximum size will be subtracted by Taskbar height but you can do this

this.WindowState = FormWindowState.Normal; // or default
this.FormBorderStyle = FormBorderStyle.None;
this.TopMost = true;

// do it here
this.Location = new Point(0,0);
var fullscreenSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
this.Size = fullscreenSize;


来源:https://stackoverflow.com/questions/1344652/hide-the-taskbar-using-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!