Comment mettre une image sur un bouton?
var
Bitmap, Bitmap2: TBitmap;
MyHandle: THandle;
Rec: TRect;
begin
Bitmap:=TBitmap.Create;
Bitmap2:=TBitmap.Create;
Bitmap2.LoadFromFile('c:\a.bmp');
Rec:=Rect(2, 2, Button1.Width-2, Button1.Height-2);
MyHandle:=GetDC(Button1.Handle);
Bitmap.Canvas.Handle:=MyHandle;
Bitmap.Canvas.StretchDraw(Rec, Bitmap2);
end;
Commentaires
Enregistrer un commentaire