How to get the screen resolution

Sometimes developers need to know the resolution of device, where the application's running.


Here is the code:



using System.Windows.Forms;


int width = Screen.PrimaryScreen.Bounds.Width;

int height = Screen.PrimaryScreen.Bounds.Height;


MessageBox.Show("The device's resolution: Width = " + width + " Height = " + height);


It's very easy ;)


0 comments:

Post a Comment