Disable dpi scaling

Hi,
I have a VCL app that displays on a secondary monitor and has only one form.
The app must look the same no matter what the dpi of the primary or secondary monitor is. It must not rescale.
I have recently upgraded to tms fnc ui pack 10.7.4.1 and some TAdvSmoothListBox that the form has, are trying to scale, breaking the layout.
The environment is Delphi XE7. Windows 10 build 19044 (latest).
Primary monitor dpi setting: 125%
Secondary monitor dpi setting: 100% (the main form app shows in this monitor)
The app manifest is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> true/pm

uncommenting the dpiAwareness tag has the same results.

Main form has scaled property set to false.

on form create this is done:
...
for i:=0 to Screen.MonitorCount-1 do
Begin
if (Screen.Monitors[i].Primary=False) then
Begin
monitor:=Screen.Monitors[i];
Break;
end;
end;
...
Self.Left:=monitor.Left;
Self.Top:=monitor.Top;
...
screenshot, previous version of tms (tms ui pack 5.5.4.1):

screenshot, current version ui pack 10.7.4.1:

I think the problem is that the component is not aware that the monitor in which the form is displayed is has dpi 100%, not 125%.
Is there any workarround?

While XE7's hi DPI support is not reliable, we can maybe think of a solution.

Can you check if in TAdvSmoothListBox.CreateWnd (in AdvSmoothListBox.pas), you change the line:

FDPIScale := GetDPIScale(Self, Canvas);

to

FDPIScale := 1;

it behaves as you want?

No, it doesn't:

Primary monitor is at 100% dpi in this case and secondary at 100%.

I tried changing GetDPIScale in AdvStyleIF.pas to take in consideration Form's Scaled property IFNDEF DELPHIXE10_LVL, and it almost does. (if not Scaled then Result := 1), but it seems that font height is still scaled:

when primary and secondary monitors are both at 100%:

We further investigated and suspect it is due to GDI+ font creation and use.
We applied improvements in this area and the next update will address this.

1 Like