Hello TMS team,
I’m having high-dpi issues with tAdvStringGrid (internal version 9.2.2.0, feb. 2026) and I’ve figured out an easy fix for it. I’m using Delphi 13.1 and Windows 11 professional.
(As a matter of fact, I’m using your much older tdbAdvStringGrid which inherits from tAdvStringGrid because I need some very specific behavior that prevents me from using tDBAdvGrid - but that’s beside the point. The issue I’m seeing is caused by a routine inside tAdvStringGrid and it may affect tDBAdvGrid as well).
The issue:
When I move a form containing such a grid between two monitors with different DPI numbers, it appears that checkboxes very often get re-scaled wrong (see image in the attachment). The behavior is very haphazard. Sometimes it works, sometimes it doesn’t.
I dug a bit deeper and I see that the issue is caused inside routine tAdvStringGrid.ChangeScale().
At some point, it calls “FDPIScale :=GetDPIScale(Self, Canvas)” and as I observe, that function is not 100% reliable inside the context of ChangeScale(), it sometimes returns the previous scale factor (before the dpi change) instead of the new one that we want (after the dpi change).
But why bother using this function at all? The whole purpose of ChangeScale() is that Windows and Delphi tell the window what the new dpi number is going to be … So IMO there’s really no need to figure it out again …
Therefore my proposal is to simply exchange that line of code for “FDPIScale := M / 96“ . With this simple change, the scaling works reliably. I can now drag my windows between monitors with different dpi numbers and the checkboxes always look correct.
