Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong ItemHeight when ParentFont is True in Delphi 11 #36

Open
pyscripter opened this issue Oct 15, 2021 · 0 comments
Open

Wrong ItemHeight when ParentFont is True in Delphi 11 #36

pyscripter opened this issue Oct 15, 2021 · 0 comments

Comments

@pyscripter
Copy link
Contributor

Delphi 11 changed the default font to Segoe UI 9 pts. The default FItemHeight of 17 is too small for that font. The problem is much worse with High DPI applications. See image below:

image

The problem is that when using the default font (ParentFont is True) TzScrollObjInspectorList.CMFONTCHANGED, which correctly sets FItemHeight is not called.

Solution:

Add another method TzScrollObjInspectorList.CMPARENTFONTCHANGED with the following code:

procedure TzScrollObjInspectorList.CMPARENTFONTCHANGED(
  var Message: TCMParentFontChanged);
begin
  inherited;
  if ParentFont then
  begin
    Canvas.Font.Assign(Font);
    FItemHeight := Canvas.TextHeight('WA') + 4;
  end;
end;

This method is always called and the problem is solved. And while fixing this you may want to expose the ParentFont property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant