Hint - como personalizar

Top  Previous  Next

{

 

1. faça um projeto novo,

2. coloque um button e um hint, showhint = true

3. coloque uses uniHint. Só!!

 

 

}

 

 

unit untHint; 

 

interface 

 

uses 

  Windows, Controls, Forms, Graphics; 

 

type 

  TAppHintWindow = class ( THintWindow ) 

  protected 

    procedure Paint; override; 

    function CalcHintRect ( MaxWidth: Integer; const AHint: string; AData: Pointer ): TRect; override; 

  end

 

implementation 

 

function TAppHintWindow.CalcHintRect; 

var 

   r: TRect; 

begin 

     r := inherited CalcHintRect ( MaxWidth, AHint, AData ); 

     inflateRect ( r, 63 ); 

     result := r; 

end

 

procedure TAppHintWindow.Paint; 

var 

   R: TRect; 

begin 

     with Canvas do begin 

 

          R := ClientRect; 

 

          Brush.Color := $00EAFFFF

          FillRect ( r ); 

          Font.Name := 'Tahoma'

 

          Inc ( R.Left7 ); 

          Inc ( R.Top, 5 ); 

 

          DrawText ( canvas.Handle, PChar ( Caption ), -1, R, DT_LEFT or DT_NOPREFIX or DT_WORDBREAK ); 

     end

end

 

initialization 

 

  HintWindowClass := TAppHintWindow; 

 

end..