Alterar fonte do hint

Para testar este exemplo inclua no seu form alguns componentes. Nestes componentes coloque informações 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}

// Função que irá alterar a fonte do Hint
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
   // Ativa a função que irá alterar o formato do Hint
   Application.OnShowHint := MyShowHint;
end;



Comentários

Postar um comentário

Postagens mais visitadas deste blog

[resolvido] USB To Serial Prolific no Windows 7 e 8x e 10

Corrigir BAD_SYSTEM_CONFIG_INFO no Windows 7,8, 8.1, 10

Como Alterar o Perfil da Rede Pública para Privada no “Windows 8.1″ e “Windows Server 2012″