2

In a Delphi 10.4.2 32-bit VCL application on Windows 10, I am trying to customize the Hint Font.Size:

type
  TExHint = class(THintWindow)
    constructor Create(AOwner: TComponent); override;
  end;
    
var
  Form1: TForm1;
    
implementation
    
{$R *.dfm}
    
constructor TExHint.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  with Canvas.Font do
  begin
    //Name  := 'Verdana';
    Size  := 15;
    //Style := [fsBold, fsItalic];
  end;
end;
    
procedure TForm1.FormCreate(Sender: TObject);
begin
  HintWindowClass  := TExHint;
end;

But it does not work.

How can I customize the Hint Font.Size of my application?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
user1580348
  • 5,721
  • 4
  • 43
  • 105

1 Answers1

9

It's much easier than this.

Just set the Screen.HintFont property:

procedure TForm.FormCreate(Sender: TObject);
begin
  Screen.HintFont.Size := 20;
end;

Screenshot of hint with large font

or even

Even larger font size

or

Even larger

Andreas Rejbrand
  • 105,602
  • 8
  • 282
  • 384
  • It works - but there's a huge gap between the lines of a multi-line hint: https://i.imgur.com/npUF4dD.png – user1580348 Jul 09 '21 at 22:40
  • @user1580348: I think it looks good: https://privat.rejbrand.se/hintsize2ln.png. I suspect you have two line breaks (#13#10#13#10) instead of only one (#13#10). – Andreas Rejbrand Jul 09 '21 at 22:43
  • You are right. The CnPack Hint-Editor Wizard seems to add an additional `#13#10` when creating a multi-line Hint! – user1580348 Jul 09 '21 at 22:54