- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Using an Icon as the Glyph in a TSpeedButton

Question:

Is it possible to use an icon as the Glyph in a TSpeedButton component?

Answer:

The following example demonstrates painting an Icon's image 
onto a SpeedButton's Glyph.

Example:

uses ShellApi;

procedure TForm1.FormShow(Sender: TObject);
var
  Icon: TIcon;

begin
  Icon := TIcon.Create;
  Icon.Handle :=
  ExtractIcon(0,
              'C:\WINDOWS\NOTEPAD.EXE',
              1);
  SpeedButton1.Glyph.Width := Icon.Width;
  SpeedButton1.Glyph.Height := Icon.Height;
  SpeedButton1.Glyph.Canvas.Draw(0, 0, Icon);
  Icon.Free;
end;



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile