- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Changing the font in a hint window

Question:

How can I change the font of a hint window?

Answer:

The following example traps the Application.OnShowHint event and

changes the font.



Example:



type

  TForm1 = class(TForm)

    procedure FormCreate(Sender: TObject);

  private

    { Private declarations }

  public

    procedure MyShowHint(var HintStr: string;

                         var CanShow: Boolean;

                         var HintInfo: THintInfo);

    { Public declarations }

  end;



var

  Form1: TForm1;



implementation



{$R *.DFM}



procedure TForm1.MyShowHint(var HintStr: string;

                            var CanShow: Boolean;

                            var HintInfo: THintInfo);

var

  i : integer;

begin

  for i := 0 to Application.ComponentCount - 1 do

    if Application.Components[i] is THintWindow then

      with THintWindow(Application.Components[i]).Canvas do begin

        Font.Name   := 'Arial';

        Font.Size   := 18;

        Font.Style  := [fsBold];

        HintInfo.HintColor := clWhite;

      end;

end;



procedure TForm1.FormCreate(Sender: TObject);

begin

  Application.OnShowHint := MyShowHint;

end;




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile