January 10, 2014 by Nitesh

How to Get Width & Height of Desktop in WinForms


In certain scenarios we need to know the screen resolution our desktop application will be running on. To get this information, Microsoft provides us with a very handy class namely SystemInformation that can be found in System.Windows.Forms namespace. Using this class, we can almost every information about the current system environment, the application is running on.

To get the Height and Width of the Desktop screen, use the below 2 lines of code –

int height = SystemInformation.VirtualScreen.Height;
int width = SystemInformation.VirtualScreen.Width;


Dim height as Integer = SystemInformation.VirtualScreen.Height
Dim width as Integer = SystemInformation.VirtualScreen.Width

Hope you like this post! Cheers!

#C##How To?#VB.Net#Winforms
  • Young_Edith

    What if I need the virtual WORKING AREA????

    • Nitesh Luharuka

      Use SystemInformation.WorkingArea.Height and SystemInformation.WorkingArea.Width properties

Support us!

If you like this site please help and make click on any of these buttons!

Powered by WordPress Popup