Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

full screen mode, but don't cover the taskbar

Tags:

c#

.net

winforms

I have a WinForms application, which is set to full screen mode when I login.

My problem is it's covering the Windows taskbar also. I don't want my application to cover the taskbar.

How can this be done?

like image 779
user698065 Avatar asked Jun 20 '11 17:06

user698065


2 Answers

The way I do it is via this code:

this.MaximizedBounds = Screen.FromHandle(this.Handle).WorkingArea;
this.WindowState = FormWindowState.Maximized;
like image 115
Arcanox Avatar answered Nov 08 '22 21:11

Arcanox


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;
    }
}
like image 31
Per Avatar answered Nov 08 '22 21:11

Per