1. Home
  2. Computing & Technology
  3. Delphi Programming

Show *any* graphics as Glyph on a SpeedButton

By , About.com Guide

TBitBtn and TSpeedButton accept only BMP pictures, if you have some other picture format, like ICO or JPG, (in an Image component) you want to show as a Glyph, you'll need to "transform" it to Bitmap, here's how:

~~~~~~~~~~~~~~~~~~~~~~~~~
var
   bmp: TBitmap;
begin
   bmp:=TBitmap.Create;
   try
     bmp.Width := Image.Picture.Graphic.Width;
     bmp.Height := Image.Picture.Graphic.Height;
     bmp.Canvas.Draw(0, 0, Image.Picture.Graphic) ;
     BitBtn.Glyph:=bmp;
   finally
     bmp.Free;
   end;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» Drag'n'Drop nodes inside TreeView
« Hide another application

Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. 2001 Delphi Tips
  7. Show *any* graphics as Glyph on a SpeedButton

©2009 About.com, a part of The New York Times Company.

All rights reserved.