Question and Answer Database FAQ1758D.txt Bitmaps and captions on TBitBtn Category :VCL Platform :All Product :All 32 bit Question: When I use BitBtn, the Caption(text) and bitmap file cannot be seen at the same time. How can I work around this? Answer: This can happen if the bitmap is too large. The TBitBtn class displays the bitmap first, and then displays the caption above, below, to the right, or to the left, of the bitmap (depending on the Layout property). If the bitmap is as wide as the button, then there isn't any room to display the caption. If you are trying to use bitmaps which are the same size as your button (and you want the caption displayed on top of the bitmap), you will need to create a bitmap image with the captioned text drawn onto the bitmap's canvas. Example: var bm : TBitmap; OldBkMode : integer; begin bm := TBitmap.Create; bm.Width := BitBtn1.Glyph.Width; bm.Height := BitBtn1.Glyph.Height; bm.Canvas.Draw(0, 0, BitBtn1.Glyph); OldBkMode := SetBkMode(bm.Canvas.Handle, Transparent); bm.Canvas.TextOut(0, 0, 'The Caption'); SetBkMode(bm.Canvas.Handle, OldBkMode); BitBtn1.Glyph.Assign(bm); end; 7/16/98 4:31:28 PM
Last Modified: 01-SEP-99