2

Delphi7. I have Listbox, OwnerDrawn, with fixed ItemHeight. Now i want to make it look OK on 125% Windows font sizes. Currently i see that items font is increased but ItemHeight isn't, so items are "truncated" by Y. How to adjust ItemHeight when OS has 125% or 150% font sizes?

4

1 回答 1

1

不能将 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;
于 2013-02-14T15:53:40.453 回答