Mega Code Archive

 
Categories / Delphi / Graphic
 

Use icons on a speedbutton

Title: Use icons on a speedbutton Question: How to convert ico-resource into speedbutton's bitmap? Answer: Just copyrect the Icon into the Bitmap of a Speed button. var imgIcon: TIcon; imgRect: TRect; BEGIN imgIcon := TIcon.Create; imgIcon.Handle := ExtractIcon( 'EXEFILENAME' ); with SpeedButton1.Glyph do BEGIN Width := imgIcon.Width; Height := imgIcon.Height; imgRect := Rect( 0, 0, Width, Height ); Canvas.CopyRect( imgRect, imgIcon.Canvas, imgRect ); end;