Search code examples
delphiwindows-8tabletdpi

Why is Screen returning a lower resolution than my Windows 8 tablet is set to?


I've got a Windows 8 tablet with a Full HD resolution of 1920x1080 pixel set.

But when I use Delphi's Screen object to get the Screen.Width and Screen.Height it will return a resolution of 1280x720 running on that Windows 8 tablet.

Where is the problem rooted? On the Windows (tablet) side or on the Delphi side? I use Delphi 7 up to XE2 with equal results. This seems to be rather a tablet problem than a general Windows 8 problem since I do not have such a behavior on my Windows 8.1 desktop machine.


Conclusion

I just wanted to highlight the cause of my problem since it is kind of hidden in the comments.
By default Windows 8 on my tablet is using 150% DPI. 1080px are 150% of 720px. So 720px are usable by applications. Decreasing the DPI percentage to 100% results in the expected 1080px resolution.


Solution

  • It could be DPI-related problem. Aero can handle high-DPI situations in two ways:

    • Say to the application, that DPI is greater than standart 96, and let it scale itself
    • Lie to the application, that DPI is usual 96, and scale it's window with some image-scalling algorithm (produces blur)

    May be in the second situation Aero is lying not only about DPI, but also about screen resolution.


    If the second scenario is your case, then DO NOT turn off scaling. Just make your application DPI-aware: http://www.rw-designer.com/DPI-aware - general info http://www.micro-isv.asia/2010/09/high-dpi-support-in-windows-vista-and-7/ - delphi