Search code examples
c++imagebuttonc++buildervcl

Load a bmp file into a TSpeedButton


Using Embarcadero C++Builder, does anyone know how to manually load a .bmp file into a TSpeedButton using the Glyph property, setting a path to the image, not with the Object Inspector?


Solution

  • The Glyph property is a TBitmap, so you can use the TBitmap::LoadFromFile() method to load a new glyph from a file:

    speedbutton->Glyph->LoadFromFile("filename.bmp");
    

    Note: "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."