1

I am developing a kinect application using WPF. Now I need to get the actual desktop screen resolution so that I can scale the area to take screenshot for any laptops. I have tried PrimaryScreenWidth, PrimaryScreenHeight, FullScreenHeight, and all that, but none of them give me the ACTUAL resolution. For example, if I have 1920*1080, those above fields will give me some other values.

I was wondering how to get the actual desktop screen resolution from C# WPF?

0

1 Answer 1

7

Just use this:

System.Windows.SystemParameters.PrimaryScreenWidth System.Windows.SystemParameters.PrimaryScreenHeight 

or this:

System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height 
Sign up to request clarification or add additional context in comments.

2 Comments

This returns the screen size independent of the actual resolution.
@JanErikSchlorf this solution works with dpiInfo. VisualTreeHelper.GetDpi(window). System.Windows.SystemParameters.PrimaryScreenWidth / dpiInfo.DpiScaleX

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.