Reputation: 1567
I need to maximize my application in C# that it will be over the taskbar. I have change the property WindowState = Maximized. But the lower part of the application appears under the taskbar. I want the status bar to appear above with the taskbar also shown below it.
It's maximized but where is my statusbar :)
This is Normal State of Window; you can see status bar in this pic.
Upvotes: 3
Views: 4942
Reputation: 11
First, make sure that you have no ControlBox, but text in the Form Text - this adds the title bar. Then, set your form WindowState
to Maximized
.
The last thing you do in the Form_Load
event is to set the form Text
property to an empty string. The Title bar is removed, the form is maximized, and the Task Bar is visible.
Upvotes: 1
Reputation: 239636
As I indicated in my comment, you've done something odd to your window, which is why you're getting this behaviour. I can reproduce this. I created a new WinForms project, put a button on the form that has this code:
private void button1_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Maximized;
}
Added a status bar, and set the MaximizeBox
property of the form to false. Running the code, pressing my custom button, the form maximizes, but the status bar disappears behind the task bar.
If I then close the form, re-enable the MaximizeBox
property, and re-run the project, then maximizing the form gets the behaviour you want (the status bar's bottom is aligned with the top of the task bar). So re-enable your MaximizeBox
and you should be done.
(Once the Maximize box is available, maximizing works whether using that or the custom button)
Upvotes: 3
Reputation: 2911
I am guessing that you have TopMost property set to 'True'. If you need this setting then you can get taskbar information from a Win32 API call. There is some information about it here:
Otherwise you could just disable the TopMost setting. You may want to check that your program runs in 64bit os (if you are not already using this). I use VirtualBox with a 64 bit guest o/s for testing 64bit on my 32 bit host. (Requires a 64 bit processor though.)
I hope that this helps.
Upvotes: 0