function NewBitBtn( AParent: PControl; const Caption: KOLString; Options: TBitBtnOptions; Layout: TGlyphLayout; GlyphBitmap: HBitmap; GlyphCount: Integer ): PControl;
Creates image button (actually implemented as owner-drawn). In Options, it is possible to determine, whether bitmap or image list used to contain one or more (up to 5) images, correspondent to certain BitBtn state.
For case of imagelist (option bboImageList), it is possible to use a number of glyphs from the image list, starting from image index given by GlyphCount parameter. Number of used glyphs is passed in that case in high word of GlyphCount parameter (if 0, one image is used therefore). For bboImageList, BitBtn can be Transparent (and in that case bboNoBorder style can be useful to draw custom buttons of non-rectangular shape).
For case of bitmap BitBtn, image is stretched down (if too big), but can not be transparent. It is not necessary for bitmap BitBtn to pass correct GlyphCount - it is calculated on base of bitmap size, if 0 is passed.
And, certainly, BitBtn can be without glyph image (text only). For that case, it is therefore is more flexible and power than usual Button (but requires more code). E.g., BitBtn can change its Font, Color , and to be totally Transparent. Moreover, BitBtn can be Flat , bboFixed, SpeedButton and have property RepeatInterval.
Note: if You use bboFixed Style, use OnChange event instead of OnClick, because Checked state is changed immediately however OnClick occure only when mouse or space key released (and can be not called at all if mouse button is released out of BitBtn bounds). Also, bboFixed defines only which glyph to show (the border if it is not turned off behaves as usual for a button, i.e. it becomes lowered and then raised again at any click).
Here You can find references to other properties, events and methods applicable to BitBtn:
property OnBitBtnDraw: TOnBitBtnDraw; |
|
---|---|
property OnTestMouseOver: TOnTestMouseOver; |
|
function LikeSpeedButton: PControl; |
|
property Caption: KOLString; |
|
property BitBtnDrawMnemonic: Boolean; |
|
property TextShiftX: Integer; |
|
property TextShiftY: Integer; |
|
property BitBtnImgIdx: Integer; |
|
property BitBtnImgList: THandle; |
|
property DefaultBtn: Boolean; |
|
property CancelBtn: Boolean; |
|
property TextAlign: TTextAlign; |
|
property MouseInControl: Boolean; |
|
property Flat: Boolean; |
|
property RepeatInterval: Integer; |
|
property ImageListNormal: PImageList; |
|
property Checked: Boolean; |