RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TSpeedButton.Glyph Property

Specifies the bitmap that appears on the speed button.

Pascal
property Glyph: TBitmap;
C++
__property TBitmap Glyph;

Set Glyph to a bitmap object that contains the image that should appear on the face of the button. Bring up the Open dialog box from the Object Inspector to choose a bitmap file (with a .BMP extension), or specify a bitmap file at runtime. 

Glyph can provide up to four images within a single bitmap. All images must be the same size and next to each other in a horizontal row. TSpeedButton displays one of these images depending on the state of the button.

Image position 
Button state 
Description 
First  
Up  
This image appears when the button is unselected. If no other images exist in the bitmap, this image is used for all states.  
Second  
Disabled  
This image usually appears dimmed to indicate that the button can't be selected.  
Third  
Clicked  
This image appears when the button is clicked. If GroupIndex is 0, the Up image reappears when the user releases the mouse button.  
Fourth  
Down  
This image appears when the button stays down indicating that it remains selected.  

If only one image is present, TSpeedButton attempts to represent the other states by altering the image slightly for each state, although the Down state is always the same as the Up state.  

If the bitmap contains multiple images, specify the number of images in the bitmap with the NumGlyphs property.

Note: The lower left pixel of the bitmap is reserved for the "transparent" color. Any pixel in the bitmap that matches the lower left pixel will be transparent.
 

C++ Examples: 

 

/*
The following line copies the bitmap of a speed button named
SpeedButton1 to the clipboard and then copies the clipboard
to the image picture.  Note that you must add Clipbrd to the
uses clause.
*/
#include <Clipbrd.hpp>

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  Clipboard()->Assign(SpeedButton1->Glyph);
  Image1->Stretch = True;
  Image1->Picture->Assign(Clipboard());
}

 

Delphi Examples: 

{
The following line copies the bitmap of a speed button named
SpeedButton1 to the clipboard and then copies the clipboard
to the image picture.  Note that you must add Clipbrd to the
uses clause.
}
uses Clipbrd;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Clipboard.Assign(SpeedButton1.Glyph);
  Image1.Stretch := True;
  Image1.Picture.Assign(Clipboard);
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!