1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
| HINT + Icone Bmp
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, shellapi;
type
TForm1 = class(TForm)
...
procedure FormCreate(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
TMyHintWindow = class(THintWindow)
private
ABitmap: TBitmap;
protected
procedure Paint; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
HintWindowClass := TMyHintWindow;
ShowHint := true;
Hint := ' Une image dans une info-bulle..'
end;
constructor TMyHintWindow.Create(AOwner: TComponent);
begin
inherited;
ABitmap:= TBitmap.Create;
try
ABitmap.LoadFromFile('popo.bmp');
ABitmap.Transparent := true;
except
FreeAndNil(ABitmap);
end;
end;
destructor TMyHintWindow.Destroy;
begin
ABitmap.Free;
inherited;
end;
procedure TMyHintWindow.Paint;
var DC: HDC;
R: TRect;
begin
if Assigned(ABitmap) then
Canvas.Draw(1, 2, ABitmap);
inherited;
DC := GetWindowDC(Handle);
try
R := Rect(0, 0, Width, Height);
DrawEdge(DC, R, EDGE_ETCHED , BF_RECT + BF_MONO);
finally
ReleaseDC(Handle, DC);
end;
end;
end. |
Partager