简体   繁体   中英

How to make a form behave like windows taskbar using c#

I have created a taskbar using tabcontrols which works similarly to the Windows taskbar. I want to make my own taskbar fixed on top of the windows.

It should not be movable, resizable, and it should be "docked" to the top.

I have not tried to do this, but my first attempt would be the following:

  • set form to be 'TopMost'
  • set border to 'None'
  • set Location: (0,0), Size(Screen.Width,H), where H is the Height you want your form to be
  • set 'ShowInTaskBar' to false

Something you might consider: how will you handle multiple screens?

You'll likely want to add a context menu allowing you to exit the application, since it won't have the normal system buttons. Also, you might consider what happens when the user presses ALT-F4: will your program close? If not, you'll need to add some code in the FormClosing event handler to cancel closing.

Hope this sets you in the right direction!

A long long time ago Jeffery Richter demonstrated how to do a true taskbar in a sample called AppBar (I've used it myself as a boiler plate), so here are some pages that may be of interest:

http://www.google.com/search?q=Jeffrey+Richter+appbar+c#

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM