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

Show *any* graphics as Glyph on a SpeedButton

By Zarko Gajic, About.com

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

Zarko Gajic
Guide since 1998

Zarko Gajic
Delphi Programming Guide

Explore Delphi Programming
About.com Special Features

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

Easy ways to connect two computers for networking purposes. 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.