-
Notifications
You must be signed in to change notification settings - Fork 273
Closed
Description
procedure TBaseVirtualTree.AutoScale();
// If toAutoChangeScale is set, this method ensures that the default node height is set correctly.
var
lTextHeight: TDimension;
begin
if HandleAllocated and (toAutoChangeScale in TreeOptions.AutoOptions) then
begin
Canvas.Font.Assign(Self.Font);
lTextHeight := Canvas.TextHeight('Tg') + 2;
Shouldn't the last statement be:
lTextHeight := Canvas.TextHeight('Tg') + ScaledPixels(2);
My laptop has a scaling factor of 300% and that scaling may make a difference in the visual density of rows.
Looking at TControl.Change scale I saw that the FCurrentPPI is updated after the font is changed. So the following would work also when ParentFont is False, since CurrentPPI gets the PPI from the Window handle.
lTextHeight := Canvas.TextHeight('Tg') + MulDiv(2, CurrentPPI, 96);