从Screen Class获取错误的屏幕分辨率

时间:2014-12-16 01:56:20

标签: c# .net screen screen-resolution

我正在为日常工作构建一些工具。 我尝试使用Screen.PrimaryScreen.Bounds.Height/Width来获得系统解析 但是,如果系统被设置为"没有小的" DPI设置,c#将回复错误的分辨率 例如:当我的DPI设置为小时,我可以获得真正的分辨率为1920x1080。 但分辨率在中DPI设置下变为1536x864,在大DPI设置下变为1280x720

看起来c#只能通过Screen类从系统获得虚拟分辨率。

还有其他方法可以获得" Real"显示分辨率? 我尝试SystemInformation,结果相同

1 个答案:

答案 0 :(得分:0)

在WPF应用程序中,您可以尝试以下任何属性来找出最适合您任务的属性:

SystemParameters.PrimaryScreenWidth
SystemParameters.PrimaryScreenHeight

SystemParameters.VirtualScreenWidth
SystemParameters.VirtualScreenHeight

SystemParameters.WorkArea.Width
SystemParameters.WorkArea.Height

希望这会有所帮助。最好的问候,

相关问题