Поделиться через


CButton::GetState

Retrieves the state of a radio button or check box.

UINT GetState( ) const;

Возвращаемое значение

Specifies the current state of the button control. You can use the following masks against the return value to extract information about the state:

Mask

Meaning

0x0003

Specifies the check state (radio buttons and check boxes only). A 0 indicates the button is unchecked. A 1 indicates the button is checked. A radio button is checked when it contains a bullet (•). A check box is checked when it contains an X. A 2 indicates the check state is indeterminate (three-state check boxes only). The state of a three-state check box is indeterminate when it contains a halftone pattern.

0x0004

Specifies the highlight state. A nonzero value indicates that the button is highlighted. A button is highlighted when the user clicks and holds the left mouse button. The highlighting is removed when the user releases the mouse button.

0x0008

Specifies the focus state. A nonzero value indicates that the button has the focus.

Пример

CButton myPushButton;

// Create a push button.
myPushButton.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, 
   CRect(10,10,100,30), pParentWnd, 1);

// Invert the highlight state of the button.
myPushButton.SetState(!(myPushButton.GetState() & 0x0004));

Требования

Header: afxwin.h

См. также

Основные понятия

CButton Class

CButton Members

Hierarchy Chart

CButton::GetCheck

CButton::SetCheck

CButton::SetState

BM_GETSTATE