full screen mode, but don't cover the taskbar

The way I do it is via this code:

this.MaximizedBounds = Screen.FromHandle(this.Handle).WorkingArea;
this.WindowState = FormWindowState.Maximized;

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;
    }
}

I had answer it here:

One thing I left out of the description--I'd turned off the maximize button. When I tested turning that property back on, the task bar showed up again. Apparently it assumes if you don't want a maximize button you are creating a kiosk-style application where you don't want your users to see anything but the application screen. Not exactly what I'd expect, but works I guess.

I had this problem and solved it by Jeff's help. First, set the windowstate to Maximized. but Do not disable the MaximizeBox. Then if you want MaximizeBox to be disabled you should do it programmatically:

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

Tags:

C#

.Net

Winforms