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


CButton::SetCheck

Sets or resets the check state of a radio button or check box.

void SetCheck(
   int nCheck 
);

Параметры

  • nCheck
    Specifies the check state. This parameter can be one of the following:

    Value

    Meaning

    BST_UNCHECKED

    Set the button state to unchecked.

    BST_CHECKED

    Set the button state to checked.

    BST_INDETERMINATE

    Set the button state to indeterminate. This value can be used only if the button has the BS_3STATE or BS_AUTO3STATE style.

Заметки

This member function has no effect on a pushbutton.

Пример

CButton myA3Button;

// Create an auto 3-state button.
myA3Button.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_AUTO3STATE, 
   CRect(10,10,100,30), pParentWnd, 1);

// Set the check state to the next state 
// (i.e. BST_UNCHECKED changes to BST_CHECKED
// BST_CHECKED changes to BST_INDETERMINATE
// BST_INDETERMINATE changes to BST_UNCHECKED).
myA3Button.SetCheck(((myA3Button.GetCheck() + 1 ) % 3));

Требования

Header: afxwin.h

См. также

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

CButton Class

CButton Members

Hierarchy Chart

CButton::GetCheck

CButton::GetState

CButton::SetState

BM_SETCHECK