Главная страница | назад





Article #17122: Using an Icon as the Glyph in a TSpeedButton

 Question and Answer Database
FAQ2122D.txt Using an Icon as the Glyph in a TSpeedButton
Category :VCL
Platform :All
Product :All 32 bit
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;
7/16/98 4:31:28 PM

Last Modified: 01-SEP-99