Delphi Tips&Tricks News   Tips   .NET Software   VCL Software   Search   Contacts
Ultimate Pack - special offer!

Ultimate Pack  hot!
Image Editor  new!
Runtime Fusion
Form Designer
Object Inspector
Print Suite Pro
Commented Image
Delphi Toys
WinDowse
Delphi Bonus
TMS Scripter Studio
Form Designer VB
Form Designer .NET

...get more...
for Delphi.NET, C#, VB.NET
for Delphi VCL, BCB 3-6

WinAPI Online
Unix Manual Pages
MegaDetailed.NET
in3steps.com
cdtrrracks.com new!

Blogspot  greatis.blogspot.com

Get image on the button - Components - Tips & Tricks - Greatis Delphi Pages

Use GetDC function (this function returns handle of a display device context) and Handle method of Bitmap.Canvas for assigning result of GetDC function with it.


procedure TForm1.Button1Click(Sender: TObject);
var
  Bitmap, Bitmap2: TBitmap;
  ButHandle: THandle;
  Rec: TRect;
begin
  Bitmap:=TBitmap.Create;
  Bitmap2:=TBitmap.Create;
  Bitmap2.LoadFromFile('factory.bmp');
  Rec:=Rect(2, 2, Button1.Width-2, Button1.Height-2);
  ButHandle:=GetDC(Button1.Handle);
  Bitmap.Canvas.Handle:=ButHandle;
  Bitmap.Canvas.StretchDraw(Rec, Bitmap2);
end;
For more
Delphi Help

Download source