Search code examples
delphihintdelphi-10.4-sydney

How to customize Hint Font.Size?


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?


Solution

  • 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