SECBitmapButton Class

class SECBitmapButton: public SECOwnerDrawButton

The SECBitmapButton class implements a button which displays a bitmap and an optional caption on the button face.

Defined in: SECBTNS.h

Comments

The alignment modes are specified in Alignment. The alignment of the bitmap in all modes except SECBitmapButton::Al_Center is always offset from the horizontal and vertical margins. This offset can be set with the SetIndents function. The caption will always be clipped so that it does not overwrite the bitmap.

See the COLOR sample in the \\OT\\SAMPLES\\STANDARD\\CONTROLSCOLRWELL directory for a demonstration of this class.

Example

You can attach SECBitmapButton objects to existing push buttons with

m_bmpButton.AttachButton(IDC_BUTTON1,
		SECBitmapButton::Al_Left,
		IDB_BMP, this);
You can dynamically create an SECBitmapButton button control with

m_bmpButton.Create("Help",
		WS_VISIBLE|WS_TABSTOP|WS_CHILD, SECBitmapButton::Al_Left, IDB_HELP,
		rect, this, IDC_BUTTON1);

enum Alignment

The alignment modes.

Class Members

Creation/Initialization

FOUNDATION_API SECBitmapButton()

Creates a bitmap button object.

FOUNDATION_API virtual BOOL AttachButton(int nCtlID, Alignment alignment, int nIDBmp, CWnd* pParentWnd, int iFlags=0)

Attaches the bitmap button object to an existing button.

FOUNDATION_API virtual BOOL AttachButton(int nCtlID, Alignment alignment, LPCTSTR lpszBmpName, CWnd* pParentWnd, int iFlags=0)

Attaches the bitmap button object to an existing button.

FOUNDATION_API virtual BOOL Create(LPCTSTR lpszCaption, DWORD dwStyle, Alignment alignment, LPCTSTR lpszBmpName, const CRect& rect, CWnd* pParentWnd, int nID, int iFlags=0)

Dynamically creates a bitmap button control.

FOUNDATION_API virtual BOOL Create(LPCTSTR lpszCaption, DWORD dwStyle, Alignment alignment, int nIDBmp, const CRect& rect, CWnd* pParentWnd, int nID, int iFlags=0)

Dynamically creates a bitmap button control.

Attributes

FOUNDATION_API void SetIndents(CSize sz)

Sets the bitmap margin offsets.

FOUNDATION_API CSize GetIndents() const

Returns the bitmap margin offsets.

Operations

FOUNDATION_API void SizeToContent()

Size the button to fit it's contents.

FOUNDATION_API BOOL SetBitmap(LPCTSTR lpszBmp)

Change the current bitmap

FOUNDATION_API BOOL SetBitmap(int nIDBmp)

Change the current bitmap

Overridable

FOUNDATION_API virtual void CalcLayout()

Calculates the position of the bitmap and text.

FOUNDATION_API virtual void DrawSpecific(CDC* pDC, LPDRAWITEMSTRUCT lpDS, CRect& rect)

Draws the face of the button.

FOUNDATION_API virtual void DrawFocus(CDC* pDC, CRect& rect)

Draws the focus rectangle.

Protected data members

LPCTSTR m_lpszBmpName

Resource name for bitmap.

CBitmap m_bmp

The bitmap for the button.

CSize m_indents

Indentations of bitmap from edge of button face.

CRect m_bmpRect

Window rectangle for the bitmap

CRect m_textRect

Window rectangle for the text

Alignment m_alignment

The alignment mode.