I’m trying to create a borderless form with custom close and minimize button. However it seems that when setting the border to none and window state to maximized will cause the form to hide the taskbar which is not what I want.
Note that I’m using windows 7, I’ve read a couple of answers here and elsewhere nothing seems to work for me, the taskbar is always getting hidden. A couple of things tried out with no luck are listed below:
-
this.WindowState = FormWindowState.Maximized;
this.FormBorderStyle = FormBorderStyle.None;
this.TopMost = true; -
Screen screen = Screen.FromPoint(this.Location);
this.Size = screen.WorkingArea.Size;
this.Location = Point.Empty; -
this.Bounds = Screen.PrimaryScreen.WorkingArea;
Here is the simplest solution:
In this example, I suppose that taskbar is visible, and that taskbar is positioned at bottom. You can read this question/answers How can I determine programmatically whether the Windows taskbar is hidden or not? in order to extend my example with automatic detection of taskbar status.
And here is example how to determine taskbar size: How do I get the taskbar's position and size?.
At my resolution, taskbar size is 40.