Export (0) Print
Expand All

CButton::GetButtonStyle 

Retrieves information about the button control style.


UINT GetButtonStyle( ) const;

Returns the button styles for this CButton object. This function returns only the BS_ style values, not any of the other window styles.

CButton myButton;

// Create a radio button.
myButton.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON, 
   CRect(10,10,100,30), pParentWnd, 1);

// Change the button style to use one of the "auto" styles; for
// push button, change to def push button.
UINT uStyle = myButton.GetButtonStyle();
if (uStyle == BS_PUSHBUTTON)
   uStyle = BS_DEFPUSHBUTTON;
else if (uStyle == BS_RADIOBUTTON)
   uStyle = BS_AUTORADIOBUTTON;
else if (uStyle == BS_CHECKBOX)
   uStyle = BS_AUTOCHECKBOX;
else if (uStyle == BS_3STATE)
   uStyle = BS_AUTO3STATE;

// Change the button style to the one wanted.
myButton.SetButtonStyle( uStyle );

Community Additions

ADD
Show:
© 2015 Microsoft