SECOwnerDrawButton Class
class SECOwnerDrawButton: public CButton
The SECOwnerDrawButton class is an abstract base class. SECOwnerDrawButton provides the basic functionality required for implementing an owner draw push button. You can create your own owner draw button objects simply by deriving a class from SECOwnerDrawButton and overriding the pure virtual functions DrawFocus and DrawSpecific.When the user clicks the button, the control's OnBnClicked method is called (as well as the standard BN_CLICKED notification that is sent to its parent).
See the COLOR sample in the \\OT\\SAMPLES\\STANDARD\\CONTROLS\\COLRWELL directory for a demonstration of this class.
Defined in: SECBTNS.h
Example
You can attach classes derived from SECOwnerDrawButton to existing push buttons withm_OwnerDrawButton.AttachButton(IDC_BUTTON1, this);You can dynamically create an SECOwnerDrawButton button control with
m_OwnerDrawButton.Create(NULL, WS_VISIBLE | WS_TABSTOP | WS_CHILD, rect, this, IDC_BUTTON1);
Class Members
Creation/Initialization
Creates a SECOwnerDrawButton object.
virtual BOOL AttachButton(int nCtlID, CWnd* pParentWnd, int iFlags=0)
Attaches to an existing button control.
virtual BOOL Create(LPCTSTR lpszCaption, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, int nID, int iFlags=0)
Dynamically creates an SECOwnerDrawButton button control.
Overridable
inline virtual void OnBnClicked()
Called when button is clicked
virtual LRESULT OnSetStyle( WPARAM wParam, LPARAM lParam )
Called when a BM_SETSTYLE message is sent ( Win32 Only).
virtual void DrawItem(LPDRAWITEMSTRUCT lpDS)
Draws the button by calling DrawButton
virtual void PreDrawButton(CDC* pScreenDC, CDC* pMemDC)
Called before drawing the button.
virtual CRect DrawButton(CDC* pDC, LPDRAWITEMSTRUCT lpDS )
Draws the button.
virtual void PostDrawButton(CDC* pScreenDC, CDC* pMemDC)
Called after drawing the button.
virtual void DrawDisabled(CDC* pDC, int nWidth, int nHeight)
Draws the button in a disabled state.
virtual void DrawFocus(CDC* pDC, LPDRAWITEMSTRUCT lpDS)
Draws the focus rectangle.
virtual void DrawFocus(CDC* pDC, CRect& rect)
Draws the focus rectangle.
virtual void DrawSpecific(CDC* pDC, LPDRAWITEMSTRUCT lpDS, CRect& rect)
Draws the button face.
Protected data members
BOOL m_bWin4
TRUE if windows version 4.
BOOL m_bCoolLook
TRUE if CoolLook is enabled.
DWORD m_dwPrevDefId
Contains return from DM_GETDEFID message after setfocus
DWORD m_dwPrevStyle
Contains old button style
int m_iFlags
Flags defining behavior of the button.