Retrieve the current screen resolution


Jump to: navigation, search
C# Code Snippets

C# Source Code Bank

edit

This C# code snippet allows the user to retrieve the users current screen resolution.

You can output the dimensions, in pixels, of the current video mode of the primary display to a messagebox using the following code.

MessageBox.Show( "Monitor Size:" +
   SystemInformation.PrimaryMonitorSize );

Alternatively, you can get the bounds of the virtual screen.

MessageBox.Show( "VirtualScreen: " +
   SystemInformation.VirtualScreen );

MSDN references


Share this page
  • del.icio.us
  • Facebook
  • Google+
  • StumbleUpon