How to Display a Windows Form in Full Screen on Top of the Taskbar

How to display a Windows Form in full screen on top of the taskbar?

My simple fix it turned out to be calling the form's Activate() method, so there's no need to use TopMost (which is what I was aiming at).

how to make a winform application fullscreen and cover taskbar

This goes full screen and over the taskbar for me

(also with AutoSize = true and AutoSizeMode = AutoSizeMode.GrowAndShrink)

public void fullScreenDisplay()
{
// This is required if the form reaches this code in maximized state
// otherwise the TaskBar remains on top of the form
this.WindowState = FormWindowState.Normal;

this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
this.mainPanel.Dock = DockStyle.Fill;
this.BringToFront();
}

In other words, don't try to set the dimensions neither for the form and for the panel if you want the get the default behavior. Instead force the Panel to Dock inside the full size of the form.

How to display a form in Full Screen with the taskbar on top of the form?

Set the maximum size of the form:

public Form1()
{
InitializeComponent();
this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;
this.WindowState = FormWindowState.Maximized;
}

How do I make a WinForms app go Full Screen

To the base question, the following will do the trick (hiding the taskbar)

private void Form1_Load(object sender, EventArgs e)
{
this.TopMost = true;
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
}

But, interestingly, if you swap those last two lines the Taskbar remains visible. I think the sequence of these actions will be hard to control with the properties window.

full screen mode, but don't cover the taskbar

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

How to run winform with showing taskbar?

Setting a Forms WindowState to Maximized when your BorderStyle is none will always lay over the taskbar. This is a typical behaviour of a "Fullscreen" application.

However you are on the right track. If you want to have a semi-fullscreen experience without laying over the taskbar you have to set the Location and Size of your Form manually.

Important here is that you not only set these values manually but also take away control from the OS itself as it will always try to position a Form by some ruleset.

private void Form1_Load(object sender, EventArgs e)
{
//Hiding the Border to simulate a fullscreen-experience
this.FormBorderStyle = FormBorderStyle.None;
//Telling the operating system that we want to set the start position manually
this.StartPosition = FormStartPosition.Manual;

//Actually setting our Width, Height, and Location
this.Height = Screen.PrimaryScreen.WorkingArea.Height;
this.Width = Screen.PrimaryScreen.WorkingArea.Width;
this.Location = Screen.PrimaryScreen.WorkingArea.Location;
}

Just a little side node: You might want to think about people with multiple screens and on which screen your application should appear (maybe let the user decide by some setting etc).

Menu out of place when application is in full screen by Windows API

This problem is caused by having the task bar set to the top of the screen.

It can be resolved by either moving the task bar to the bottom of the screen, or by enabling the Auto-hide task bar check box in the Properties window of the task bar.

EDIT: As stated by @slashp 's comments. The root cause of this issue comes from some inner mechanics in drawing the menu. The menu has a safety to be always drawn within the working area. Which seems to be your screen - task bar. Because the application is placed over the task bar, the calculation is placing the menu below the task bar. (you can't see it, but it's still there)



Related Topics



Leave a reply



Submit