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:
I've tried adding the followings on form load but none worked for me:
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
simply set Autoscroll = true for ur windows form..
Set the WindowState property of your form to Maximized . That will cause your form to be maximumized when it's opened. In addition, the FormBorderStyle can be set to FormBorderStyle. None to remove the border as well, for a more true maximized feeling, no borders added.
Use:
FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Maximized;
And then your form is placed over the taskbar.
I've tried so many solutions, some of them works on Windows XP and all of them did NOT work on Windows 7. After all I write a simple method to do so.
private void GoFullscreen(bool fullscreen) { if (fullscreen) { this.WindowState = FormWindowState.Normal; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Bounds = Screen.PrimaryScreen.Bounds; } else { this.WindowState = FormWindowState.Maximized; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable; } }
the order of code is important and will not work if you change the place of WindwosState and FormBorderStyle.
One of the advantages of this method is leaving the TOPMOST on false that allow other forms to come over the main form.
It absolutely solved my problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With