共用方式為


CButton::GetButtonStyle

擷取與按鈕控制項樣式的資訊。

UINT GetButtonStyle( ) const;

傳回值

傳回這 CButton 物件的按鈕樣式。 這個函式會傳回其他視窗樣式的只 BS_ 樣式值,不是中的任何一個。

範例

CButton myRadioButton;

// Create a radio button.
myRadioButton.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 = myRadioButton.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.
myRadioButton.SetButtonStyle(uStyle);

需求

Header: afxwin.h

請參閱

參考

CButton 類別

階層架構圖表

CButton::SetButtonStyle

GetWindowLong