This question already has an answer here:
I have a .net windows application that needs to run in full screen. When the application starts however the taskbar is shown on top of the main form and it only disappears when activating the form by clicking on it or using ALT-TAB. The form's current properties are as follow:
- WindowState=FormWindowState.Normal
- TopMost=Normal
- Size=1024,768 (this is the screen resolution of the machines it's going to be running on)
- FormBorderStyle = None
I've tried adding the followings on form load but none worked for me:
- this.Focus(); (after giving the focus this.Focus property is always false)
- this.BringToFront();
- this.TopMost = true; (this however would not be ideal in my scenario)
- this.Bounds = Screen.PrimaryScreen.Bounds;
- this.Bounds = Screen.PrimaryScreen.Bounds;
Is there a way to do it within .NET or would I have to invoke native windows methods and if so a code snippet would very much be appreciated.
many thanks
I believe that it can be done by simply setting your FormBorderStyle Property to None and the WindowState to Maximized. If you are using Visual Studio both of those can be found in the IDE so there is no need to do so programmatically. Make sure to include some way of closing/exiting the program before doing this cause this will remove that oh so helpful X in the upper right corner.
EDIT:
Try this instead. It is a snippet that I have kept for a long time. I can't even remember who to credit for it, but it works.
This is how I make forms full screen.
Use:
And then your form is placed over the taskbar.