德尔福7。我有具有固定ItemHeight的列表框OwnerDrawn。现在,我想使它在125%的Windows字体大小上看起来不错。目前,我看到项目字体增加了,但ItemHeight却没有,因此项目被Y“截断了”。
当OS具有125%或150%字体大小时,如何调整ItemHeight?

最佳答案

不能将OnMeasureItem用作List.Style = OwnerDrawFixed。
我的溶胶:

function ScaleFontSize(Size: Integer; Form: TForm): Integer;
begin
  Result:= Size * Form.PixelsPerInch div 96 + 1;
end;

procedure TfmSetup.TntFormCreate(Sender: TObject);
begin
  with ListTabColors do
    ItemHeight:= ScaleFontSize(ItemHeight, Self);
end;

10-08 05:18