当“更容易阅读屏幕上的内容”时,Screen.Width报告的分辨率错误。是150% [英] Wrong resolution reported by Screen.Width when "Make it easier to read what's on screen" is 150%

查看:180
本文介绍了当“更容易阅读屏幕上的内容”时,Screen.Width报告的分辨率错误。是150%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题

Screen.Width / Screen.Height报告的分辨率有时(很少)小于控制面板中报告的分辨率。 Delphi报告的分辨率始终小于实际分辨率(大约1/3)。而且这很有意义。我的意思是,这似乎是普通计算机(例如1280x720)中用于分辨率的舍入数字之一。



最近我用

  var MonInfo: TMonitorInfo; 
开始
MonInfo.cbSize:= SizeOf(MonInfo);
GetMonitorInfo(MonitorFromWindow(Application.MainForm.Handle,MONITOR_DEFAULTTONEAREST),@MonInfo);
结果:= MonInfo.rcMonitor.Right;

返回与Screen.Width / Screen.Height相同(错误)的结果。
仅在几个系统(3-4)上报告过。其中两个钩在了外部监视器/电视上。



详细信息

Delphi显示的分辨率:1280x720

控制面板显示的分辨率:1920x1080

DPI:96

使阅读屏幕内容更容易:150%

测试项目:我刚开始一个新的默认项目; ObjInspector中的属性没有更改。一个用C ++编写的小型测试程序也显示了错误的分辨率。

Delphi XE



问题

哪个Delphi函数将返回正确的分辨率,或者如何从Screen.Width(Screen.Height)报告的分辨率中计算出正确的分辨率?






移动到此处:

如何在High DPI系统中获得真实的屏幕分辨率?

解决方案

您的程序未声明自己具有高dpi感知能力。因此,它受称为DPI虚拟化的兼容模式的约束。系统将为您的程序提供虚假的屏幕尺寸和坐标,然后将程序的显示比例缩放为真实尺寸。



除了为您提供您无法识别的屏幕尺寸外,一个更重要的问题是DPI虚拟化将导致您的程序由于别名而显得模糊。该系统会尽最大努力缩放程序以适合用户所需的DPI,但是如果没有一些别名,就无法缩放光栅图像。



一些有用的链接:





如果您希望避免DPI虚拟化,并且让程序获得真正的屏幕尺寸,则应标记您的程序高度了解DPI。最好通过对DPI的高度了解的应用清单来完成。

 < assembly xmlns = urn :schemas-microsoft-com:asm.v1 manifestVersion = 1.0 
xmlns:asmv3 = urn:schemas-microsoft-com:asm.v3>
< asmv3:application>
< asmv3:windowsSettings
xmlns = http://schemas.microsoft.com/SMI/2005/WindowsSettings>
< dpiAware> true< / dpiAware>
< / asmv3:windowsSettings>
< / asmv3:application>
< / assembly>


Problem
The resolution reported by Screen.Width/Screen.Height is sometimes (rarely) smaller that the resolution reported in Control Panel. The resolution reported by Delphi is always smaller (about 1/3) than the real resolution. And it 'makes sense'. I mean it seems to be one of those 'round' numbers used for resolution in normal computers, like 1280x720.

I cannot reproduce this in my system but I got few screenshots from 3rd party computers.

Recently I used

 var MonInfo: TMonitorInfo;
 begin
  MonInfo.cbSize := SizeOf(MonInfo);
  GetMonitorInfo(MonitorFromWindow(Application.MainForm.Handle, MONITOR_DEFAULTTONEAREST), @MonInfo);
  Result:= MonInfo.rcMonitor.Right;

It returns the same (wrong) result as Screen.Width/Screen.Height. This was reported just on a couple of systems (3-4). Two of them were hooked to a external monitor/TV.

Details
Resolution shown by Delphi: 1280x720
Resolution shown by Control Panel: 1920x1080
DPI: 96
Make it easier to read what's on screen: 150%
Test project: I just started a new default project; no properties altered in the ObjInspector. A small test program made in C++ shows also the wrong resolution.
Delphi XE

Question
Which Delphi function will return the correct resolution OR how do I calculate the correct resolution from the resolution reported by Screen.Width (Screen.Height)?


Moved here:
How to obtain the real screen resolution in a High DPI system?

解决方案

Your program does not declare itself to be high dpi aware. And so it is subject to a compatibility mode known as DPI virtualization. The system will supply your program with fake screen dimensions and coordinates, and then scale your program's display to the true dimensions.

As well as giving you screen dimensions that you do not recognise, a much more significant issue is that DPI virtualization will result in your program appearing fuzzy due to aliasing. The system does its best to scale your program to fit the user's desired DPI, but it's just not possible to scale raster images without some aliasing.

Some useful links:

If you wish to avoid DPI virtualization, and have your program obtain true screen dimensions, then you should mark your program as being high DPI aware. This is best done with the high DPI aware application manifest.

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" 
    xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
  <asmv3:application>
  <asmv3:windowsSettings 
      xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
    <dpiAware>true</dpiAware>
  </asmv3:windowsSettings>
  </asmv3:application>
</assembly>

这篇关于当“更容易阅读屏幕上的内容”时,Screen.Width报告的分辨率错误。是150%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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