As shown below, there are a few functions in CButton, but i want to change its behaviour by dealing with
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
. Yes, just this one and only one functon. It would generate more code than expected if I derive a class from CButton. I wonder if it possible to process this function without Subclass, and not use derivation. If so, how? Remarks: I must use MFC, it's so hard to use pure Win32 API.
class CButton : public CWnd
{
DECLARE_DYNAMIC(CButton)
// Constructors
public:
CButton();
virtual BOOL Create(LPCTSTR lpszCaption, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID);
// Attributes
UINT GetState() const;
void SetState(BOOL bHighlight);
int GetCheck() const;
void SetCheck(int nCheck);
UINT GetButtonStyle() const;
void SetButtonStyle(UINT nStyle, BOOL bRedraw = TRUE);
HICON SetIcon(HICON hIcon);
HICON GetIcon() const;
HBITMAP SetBitmap(HBITMAP hBitmap);
HBITMAP GetBitmap() const;
HCURSOR SetCursor(HCURSOR hCursor);
HCURSOR GetCursor();
#if (_WIN32_WINNT >= 0x501)
AFX_ANSI_DEPRECATED BOOL GetIdealSize(_Out_ LPSIZE psize) const;
AFX_ANSI_DEPRECATED BOOL SetImageList(_In_ PBUTTON_IMAGELIST pbuttonImagelist);
AFX_ANSI_DEPRECATED BOOL GetImageList(_In_ PBUTTON_IMAGELIST pbuttonImagelist) const;
AFX_ANSI_DEPRECATED BOOL SetTextMargin(_In_ LPRECT pmargin);
AFX_ANSI_DEPRECATED BOOL GetTextMargin(_Out_ LPRECT pmargin) const;
#endif // (_WIN32_WINNT >= 0x501)
#if ( _WIN32_WINNT >= 0x0600 ) && defined(UNICODE)
CString GetNote() const;
_Check_return_ BOOL GetNote(_Out_z_cap_(*pcchNote) LPTSTR lpszNote, _Inout_ UINT* pcchNote) const;
BOOL SetNote(_In_z_ LPCTSTR lpszNote);
UINT GetNoteLength() const;
BOOL GetSplitInfo(_Out_ PBUTTON_SPLITINFO pInfo) const;
BOOL SetSplitInfo(_In_ PBUTTON_SPLITINFO pInfo);
UINT GetSplitStyle() const;
BOOL SetSplitStyle(_In_ UINT nStyle);
BOOL GetSplitSize(_Out_ LPSIZE pSize) const;
BOOL SetSplitSize(_In_ LPSIZE pSize);
CImageList* GetSplitImageList() const;
BOOL SetSplitImageList(_In_ CImageList* pSplitImageList);
TCHAR GetSplitGlyph() const;
BOOL SetSplitGlyph(_In_ TCHAR chGlyph);
BOOL SetDropDownState(_In_ BOOL fDropDown);
// Sets whether the action associated with the button requires elevated permissions.
// If elevated permissions are required then the button should display