«« Site Rescued »»

While the site is still going to move from its current host, a new site will now take its place. More Info.

The new site may have less content, but the core will now remain. And it will now play nicely with phones! Keep an eye on the DelphiDabbler Blog for news.

» 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 »