PrimaryScreen.Size问题 [英] Problems with PrimaryScreen.Size

查看:26
本文介绍了PrimaryScreen.Size问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间以来,我对 Screen.PrimaryScreen.Bounds.Size 的使用一直很好,但是在连接大屏幕电视的Windows7计算机上,它给出的值不正确.

I've been fine with Screen.PrimaryScreen.Bounds.Size for some time, but on my Windows7 computer attached to my big-screen TV it is giving me incorrect values.

我在其他地方读过尝试 SystemInformation.PrimaryMonitorSize ,但是给出的值相同.

I read elsewhere to try SystemInformation.PrimaryMonitorSize but that gives the same values.

当我右键单击桌面以获取屏幕分辨率"时,它显示为 1920x1080 .以上两个给了我 1280x720 .

When I right click the desktop to get Screen Resolution, it says 1920x1080. The above two are giving me 1280x720.

我也尝试过WPF版本:

I've also tried the WPF versions:

var w = System.Windows.SystemParameters.PrimaryScreenWidth;
var h = System.Windows.SystemParameters.PrimaryScreenHeight;
MessageBox.Show(new Size((int)w, (int)h).ToString());

已通过(右键单击桌面)个性化>更改了显示尺寸.桌面选项设置为150%(因为屏幕为60英寸,所以您坐得很远).

The display size has been changed via the (right click the desktop) Personalize > Desktop options to be 150% (since the screen is 60" and you sit kind of far away).

如何检测到该值,以便可以调整从上面返回的值?

How to detect this so the value's returned from the above can be adjusted?

注意:我发现了如何通过右键单击可执行文件解决此问题并调整兼容性以禁用DPI虚拟化,但是我仍然需要一个程序化的解决方案,因此我不必让用户自己进行调整:请参见- http://msdn.microsoft.com/en-us/library/dd464660(VS.85).aspx#dpi_virtualization

Note: I've discovered how to get around this with a right-click executable and adjust the compatability to disable DPI virtualization, but I still need a programatic solution so I don't have to have user's adjust this themselves: See - http://msdn.microsoft.com/en-us/library/dd464660(VS.85).aspx#dpi_virtualization

推荐答案

我不认为这是一个重复的问题,但是答案与另一个线程上的答案相同:

I don't feel this is a duplicate question, but the answer is the same as on another thread: https://stackoverflow.com/a/13228495/353147 As the question isn't about blurry fonts but why Screen.PrimaryScreen.Bounds.Size returns faulty information. It could help others.

我确实遇到了一条错误消息,即mscorlib引发了一个空错误.从此线程 http://forums.asp.net/t/1653876.aspx/1我发现取消选中启用ClickOnce安全设置"可以解决此问题.这似乎是一种hack,但是可以.

I did run into an error message, that mscorlib threw an null error. From this thread http://forums.asp.net/t/1653876.aspx/1 I was able to discover that unchecking "Enable ClickOnce security settings" fixed it. This seems like a hack, but it works.

这篇关于PrimaryScreen.Size问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆