How to get the actual desktop screen resolution in wpf?

时间:2016-07-11 22:08:39

标签: c# wpf screenshot screen-resolution

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?

Thank you in advance!

1 个答案:

答案 0 :(得分:3)

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