Full screen mode, but do not close the taskbar

I have a WinForms application that installs in full screen upon login.

My problem is that it also closes the Windows taskbar. I do not want my application to close the taskbar.

How can I do that?

+3
c # winforms
source share
9 answers

This is probably what you want. It creates a "maximized" window without hiding the taskbar.

public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load( object sender, EventArgs e ) { FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; Left = Top = 0; Width = Screen.PrimaryScreen.WorkingArea.Width; Height = Screen.PrimaryScreen.WorkingArea.Height; } } 
+11
source share

How do I do it through this code:

 this.MaximizedBounds = Screen.FromHandle(this.Handle).WorkingArea; this.WindowState = FormWindowState.Maximized; 
+9
source share

I answered it here :

One thing I missed from the description is I turned off the maximize button. When I tried to enable this property again, the taskbar reappeared. Apparently, it assumes that if you do not want the maximize button, you are creating a kiosk-style application in which you do not want your users to see anything other than the application screen. Not quite what I expect, but it works, I think.

I had this problem and it was solved with the help of Jeff. First, set windowstate to Maximized. but do not disable MaximizeBox. Then, if you want MaximizeBox to be disabled, you must do this programmatically:

 private void frmMain_Load(object sender, EventArgs e) { this.MaximizeBox = false; } 
+3
source share

If you have multiple screens, you must reset the location of MaximizedBounds:

 Rectangle rect = Screen.FromHandle(this.Handle).WorkingArea; rect.Location = new Point(0, 0); this.MaximizedBounds = rect; this.WindowState = FormWindowState.Maximized; 
+1
source share

If Maximizing is not what you are looking for (as suggested by Greebo), you will need to calculate the window size yourself by checking the location and size of the taskbar:

http://winsharp93.wordpress.com/2009/06/29/find-out-size-and-position-of-the-taskbar/

0
source share

If you have already set WindowState = Maximized; make sure you set FormBorderStyle = nothing but None. If you set it to No, it will close the taskbar.

0
source share

Try without FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; and comment lines, for example:

 public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load( object sender, EventArgs e ) { // FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; Left = Top = 0; Width = Screen.PrimaryScreen.WorkingArea.Width; Height = Screen.PrimaryScreen.WorkingArea.Height; } } 
0
source share
 private void frmGateEntry_Load(object sender, EventArgs e) { // set default start position to manual this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; // set position and size to the Form. this.Bounds = Screen.PrimaryScreen.WorkingArea; } 
0
source share

I don't explain very well, but this is the code I used to maximize or full-screen winforms that won't hide the taskbar. Hope it helps. ^^

 private void Form_Load(object sender, EventArgs e) { this.Height = Screen.PrimaryScreen.WorkingArea.Height; this.Width = Screen.PrimaryScreen.WorkingArea.Width; this.Location = Screen.PrimaryScreen.WorkingArea.Location; } 
0
source share

All Articles