Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the proper way to create a Form unobscured by the Windows taskbar?

I dock the taskbar to the left, which causes many windows to open underneath the taskbar.

None of the System.Windows.Form.FormStartPosition values take into account the taskbar except for Manual. Is this by design? It's frustrating. I want to respect the default monitor and window position values that the OS should enforce.

like image 619
Cat Zimmermann Avatar asked May 18 '09 21:05

Cat Zimmermann


2 Answers

Well, if WinForms doesn't do this automatically, you may have to set this manually.

You'd have to use System.Windows.Forms.Screen.PrimaryScreen.WorkingArea to get the area of the screen without the taskbar, and use that Rectangle to compute the startup area for the form manually, and set it as the Form's Bounds property. (Make sure the form is using FormStartPosition.Manual).

like image 150
MiffTheFox Avatar answered Nov 01 '22 12:11

MiffTheFox


I think there is no .NET way to do that. I don't see any reasons to have such one.

You can locate taskbar position and put your form there manually.

like image 32
abatishchev Avatar answered Nov 01 '22 10:11

abatishchev