Jump to content
Alexander Halser

FMX - Form scaling does not work on high-dpi monitors with high-contrast theme

Recommended Posts

I've come across a problem with FMX apps and high-contrast Windows themes. The automatic window scaling doesn't work in this case.

I wonder if this is a known problem and if yes, if it is Delphi related or Windows related?

 

You should be able to reproduce this in the following way:

 

1) Create an FMX app with a simple form

2) Make the app per-monitor-dpi-aware-v2

3) Run it normally on Windows 10 on a monitor with more than 96 dpi (scaling > 100%)

4) Switch to a high-contrast theme, repeat step (3)

5) On Windows 7 the same effect can be observed with a "basic" vs. a "classic" theme

 

Delphi versions: tested with Delphi 10.1 and 10.4 (same result). Not tested with Delphi 11.

 

My observations:

 

  1. On Win10 with a regular theme, the app behaves as it should. When started on a monitor with 96 dpi, Form1.Handle.Scale = 1 (as expected). Started from a monitor with 192 dpi (200%), Form1.Handle.Scale = 2, as expected. Moving between monitors with different resolution/scaling instantly changes the scale.
  2. On Win10 with a high-contrast theme, scaling does no longer work. When started from a monitor with 192 dpi, the form stays at its original size, as if it never received a scaling message. Moving the app between monitors does not change the scale. Instead, the app stays at its initial size (always the equivalent of 96 dpi).
  3. Same thing happens on Windows 7 with a 125% system scaling (one monitor only): with a regular Windows 7 theme, the app starts scaled with 125%, as expected.
  4. When switching Win7 to a "classic" theme (or high-contrast, for that matter), no scaling occurs.

 

A very similar VCL app, also per-monitor-dpi-aware-v2, does scale properly in all situations. It's FMX only.

 

Here's a screenshot of the FMX app on Win10 and Win7:

fmx-scaling-high-contrast.png

Edited by Alexander Halser

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×