TBitBtnLayout (C++)
Description
This example uses a bitmap button on a form that has a bitmap specified as the value of its Glyph property. When the user clicks the bitmap button, the bitmap randomly changes its position on the button:
Code
TForm1 *Form1;
Graphics::TBitmap *bmap;
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
bmap = new Graphics::TBitmap();
bmap->LoadFromFile("../../littleB_16.bmp");
// BitBtn1->Kind = bkOK;
BitBtn1->Glyph = bmap;
}
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
switch(random(4))
{
case 0: BitBtn1->Layout = blGlyphLeft; break;
case 1: BitBtn1->Layout = blGlyphRight; break;
case 2: BitBtn1->Layout = blGlyphTop; break;
case 3: BitBtn1->Layout = blGlyphBottom; break;
default: ShowMessage("Unhandled case");
};
}
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
delete bmap;
}
Uses
- Vcl.Buttons.TBitBtn.Layout ( fr | de | ja )
- Vcl.Buttons.TButtonLayout ( fr | de | ja )
- Vcl.Buttons.TBitBtn.Glyph ( fr | de | ja )