CButton

Win32++

CButton Class

Description

A button is a control the user can click to provide input to an application.  The button control provides several types of buttons, including Push Buttons, Check Boxes and Radio Buttons.

CButton is the class responsible for creating a button control.  It is typically used in a Dialog, but could also by a child of another window.

Refer to the documentation that ships with the Microsoft Windows Software Development Kit for more information on the use of button controls.   

CButton Members

Construction

CButton
CButton();
Constructor for CButton.

Attributes

GetBitmap
HBITMAP GetBitmap() const;
Returns a handle to the bitmap associated with the button.
GetButtonStyle
UINT GetButtonStyle() const;
Returns the button style.  This can be a combination of possible button styles.
GetCheck
int GetCheck() const;
Returns the check state of the a radio button or check box.
GetCursor
HCURSOR GetCursor() const;
Returns a handle to the cursor associated with the button.
GetIcon
HICON GetIcon() const;
Returns a handle to the Icon associated with the button.
GetState
UINT GetState() const;
Returns the state of the button (pushed, checked focused etc).
SetBitmap
HBITMAP SetBitmap(HBITMAP hBitmap) const;
Sets the bitmap associated with the button.
SetButtonStyle
void SetButtonStyle(DWORD dwStyle, BOOL bRedraw) const;
Sets the style of the button.
SetCheck
void SetCheck(int nCheckState) const;
Sets the check state of the a radio button or check box.
SetCursor
HCURSOR SetCursor(HCURSOR hCursor) const;
Sets the cursor associated with the button.
SetIcon
HICON SetIcon(HICON hIcon) const;
Sets the Icon associated with the button.
SetState
void SetState(BOOL bHighlight) const;
Sets the state of the button.

Overridables

PreRegisterClass
virtual void PreRegisterClass(WNDCLASS &wc);
Set the window class parameters before the window is created.
Base class Members

For base class members, refer to the members of CWnd.

Remarks

Like all common controls, the button control requires a parent window. This parent window is often a dialog, but simple windows can also be the parent window for a button control.

Refer to the DialogDemo sample to see a demonstration of the CButton class.

Summary Information

Header file stdcontrols.h
Win32/64 support Yes
WinCE support Yes
Library required Comctl32.lib