Notice Of Closure

Please note that this website is due to close down on 15th June 2020.

In the interim I will try to move as much content as possible over to my GitHub account. Thanks to everyone who has supported the site over the years.

» Help

Change the font used in hints

   

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…

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

« Return to contents »