Alterar fonte do hint

Para testar este exemplo inclua no seu form alguns componentes. Nestes componentes coloque informaes na propriedade Hint de cada componente e altere a propriedade ShowHint para True.



unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;

type
  TForm1 = class(TForm)
  Edit1: TEdit;
  Edit2: TEdit;
  Edit3: TEdit;
  procedure FormCreate(Sender: TObject);
  private
  { Private declarations }
  public
  { Public declarations }
  procedure MyShowHint(var HintStr: string;
  var CanShow: Boolean;
  var HintInfo: THintInfo);
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;

// Evento OnCreate do Form
procedure TForm1.FormCreate(Sender: TObject);
begin
  
  Application.OnShowHint := MyShowHint;
end;
    

Autor : desconhecido

Voltar