Display App in Full Screen With Windows Taskbar

Recently I started developing Windows Forms apps. Actually I wanted to develop an app for Windows 8 but I realized that wouldn't be useful for users of previous versions of Windows, so I decided to build an app using Windows Forms and provide the look of Windows 8. But since we don't have such an interesting navigation bar as in Windows 8 we will give the fullscreen look to the app but with the Windows Taskbar also so that we can easily navigate among various running applications.

In this article we will learn to do the above step-by-step. We will change the form style so that we don't have any borders as in traditional Windows Forms apps. We will also determine the width of the Windows Taskbar and also the location of the Taskbar so that our app occupies the best fit location on the screen.

Step 1: First we will create a new Windows Forms project, as in:


Step 2: Now we have to change the form border style so as to give it a better look. Navigate to the properties of Form1 and there change the FormBorderStyle to None; see:


Step 3: You will notice the control box on the top is also gone which contains the close and minimize buttons, so now we need to custom-build them if we want them. Add a close picture and the minimize picture; locate them where you want. Next we need to add some code to make these images work accordingly.

For close : Close();
For minimize : this.WindowState = FormWindowState.Minimized;


Step 4: Now we have to add an event on form load so as to force the application to load in full screen. Here is the main twist we can do it via WindowState = Maximized;

But, the above function will put your application above the Taskbar, if it satisfies your condition then good else the following method will show the Windows Taskbar also. Now we will find the working area of the screen which includes the full screen except the Windows Taskbar which is our requirement. We will do this code in the form load event.


After performing all this, our task is completed but again we have one challenge here i.e. the above code as written will work only when the Windows Taskbar is at the bottom of the screen, so we will have to find the location of the Taskbar also and set the location of the form accordingly; to do so:

Navigate to properties of Form1 : StartPosition = Manual


Now comes the coding part, we will write this code in the form1 load event, it's just an amendment to the above code only a single line added:


That's all done, Debug your app.



Up Next
    Ebook Download
    View all
    View all