Another easy question!
Firstly, what type of screen size are you looking for?
There are two types you can look at - the current working area, basically the area a maximised application will fill if it is polite, and the physical screen which expands from the top row of pixels to the bottom of the start bar on a standard setup.
Thankfully the Screen class offers up both of these as properties, so you can easily:
int height = Screen.PrimaryScreen.Bounds.Height;
int width = Screen.PrimaryScreen.Bounds.Width;
To get the exact, complete screen size (it may be better to handle this as a Drawing.Rectactle as that is how Bounds is typed, however for ease of explanation this is how I will do it here).
And, just as easily you can do:
int height = Screen.PrimaryScreen.WorkingArea.Height;
int width = Screen.PrimaryScreen.WorkingArea.Width;To get the total usable space for a friendly application.
Please don't use this to work out how big you need to make your always on top application so you can obscure the start menu - that is extremely annoying ;)
Permalink