THTMLTreeView doesn't rescale well when switching monitors

When starting my app on a monitor set to 100% Windows display scaling Laptop screen) and then dragging it over to a 4K monitor set at something larger than 100%, such as 200%, the THTMLTreeView dies not rescale itself properly. Font seems to rescale but the line spacing does not.
THTMLTreeView 1.6.0.2

100%:

200%:

What Delphi version is used?

Delphi 11.3 Patch 1
Windows 11

I found an issue with changes shown in my previous post so I deleted it and made a simpler change to htmltv which seems to fix the problem. Please let me know if this might mess anything else up. I added a conditional clause to check for the unused isDpiChange in ChangeScale like this:

{$IFDEF DELPHIXE10_LVL}
procedure THTMLTreeview.ChangeScale(M, D: Integer; isDpiChange: Boolean);
{$ENDIF}
{$IFNDEF DELPHIXE10_LVL}
procedure THTMLTreeview.ChangeScale(M, D: Integer);
{$ENDIF}
begin
  inherited;
  FDPIScale := GetDPIScale(Self, Canvas);
  {$IFNDEF DELPHIXE12_LVL}
  ItemHeight := MulDiv(FItemHeight,M,D);
  {$ENDIF}
  {$IFDEF DELPHIXE12_LVL}
  if isDpiChange and (ItemHeight = FItemHeight) then
    TreeView_SetItemHeight(self.Handle, Round(FDPIScale * FItemHeight))
  else
    ItemHeight := FItemHeight;
  {$ENDIF}
end;

Is a better solution not:

{$IFDEF DELPHIXE10_LVL}
procedure THTMLTreeview.ChangeScale(M, D: Integer; isDpiChange: Boolean);
{$ENDIF}
{$IFNDEF DELPHIXE10_LVL}
procedure THTMLTreeview.ChangeScale(M, D: Integer);
{$ENDIF}
begin
  inherited;
  FDPIScale := GetDPIScale(Self, Canvas);
  FItemHeight := -1;
  {$IFNDEF DELPHIXE12_LVL}
  ItemHeight := MulDiv(FItemHeight,M,D);
  {$ENDIF}
  {$IFDEF DELPHIXE12_LVL}
  ItemHeight := FItemHeight;
  {$ENDIF}
end;

Then the underlying treeview item height will always be updated.

I guess it might be better just in case it gets called even when isDpiChange is false.

This is strange. It works and scales fine on my 4K monitor connected to either of two PCs (one is Win11 the other is Win10) with either your fix or mine, but the customer is still having the same issue as does another customer that only has HD monitors. Both customers have multi-monitor setups as do I, and each monitor is set at different scaling.

Is there anything in your code that does something different on UHD monitors that isn't being done on HD monitors when it calculates the DPI Scale in GetDpiScale? Tomorrow I'm going to dust off an HD monitor I have to see if I can duplicate, but just thought I'd ask before I go to that trouble.

One thing they do that I have also tried is that they change the font size in the TreeView to something larger than 8... either 10 or 12, in which case I then set the ItemHeight to that times 2. But again, works fine for me.

There is no different handling between HD and UHD. All we do is get the DPI of the monitor and apply it.

Here is one way to duplicate the problem...

Notebook with an external monitor (in my case the external monitor is 4K but shouldn't matter and the notebook monitor is HD).
Notebook set at 150% display scaling (in my case that is the recommended setting)
External monitor set at 100% display scaling.
External monitor set as the main monitor.
Launch app which shows up on external monitor since it it the main monitor.
Drag the app onto the laptop screen.
The THTMLTreeView items are now overlapping (and a standard TTreeView is perfect)

We applied an improvement here after which we could not see issues anymore here.

Just downloaded the latest VCL UI 13.0.2.0 you pushed out today and looks good here as well. I hope the customer sees that it looks good too! Thanks!

Thanks for informing!