VC++ CButton::SetCheck 的使用方法

CButton::SetCheck

void SetCheck(int nCheck);

参数


nCheck

指定检查状态。 此参数可以是下列值之一:

值                                                      含义

BST_UNCHECKED                    将按钮状态为未选中状态。

BST_CHECKED                       将按钮状态设置为已选中。

BST_INDETERMINATE            将按钮状态为不确定。 此值,仅当按钮具有 BS_3STATEBS_AUTO3STATE 样式,可使用。

备注


此成员函数为普通按钮时没有效果。

示例


C++

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));
原文地址:https://www.cnblogs.com/lujin49/p/4904856.html