Change the font used in hints #199

Hints are everywhere. Almost every GUI element in Windows can be "hinted". When a user hovers the mouse over an element, a small window containing help text pops up. Is it possible to change the hint window behavior? Of course it is!

To change the font, size and style of the hint text, just use this code:

unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
 
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
  end;
 
type
  TExHint = class(THintWindow)
  public
    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  := Size + 15;
    Style := [fsBold, fsItalic];
  end;
end;
 
procedure TForm1.FormCreate(Sender: TObject);
begin
  HintWindowClass  := TExHint;
end;
 
end.
Author: Unknown
Contributor: topellina
Added: 2012/09/17
Last updated: 2012/09/17