C++ CheckBox_Porerty

时间:2023-03-09 08:50:02
C++  CheckBox_Porerty

主题

1. s

Caption属性

CheckBox

CheckDlgButton

BOOL CheckDlgButton( 
    HWND hDlg,      //
handle to dialog box
    int nIDButton,  // button
identifier 
    UINT uCheck     // check
state
);
样式

C++  CheckBox_Porerty

ID

Value

Meaning::CheckDlgButton

1

BST_CHECKED

Sets the button state to checked.

2

BST_INDETERMINATE

Sets the button state to grayed

3

BST_UNCHECKED

Sets the button state to cleared

CheckBox

int nState=m_chk1.GetCheck();
if(nState==BST_CHECKED)
{
    MessageBox("ABC");
}

看不懂:注意实例

    CString szHabitList, szHabit;
    szHabitList = "";
    for(int i=IDC_FOOTBALL; i<IDC_PINGPONG+1; i++)
    {
        CButton *pBtn = static_cast<CButton *>(GetDlgItem(i));
        if
(pBtn != NULL)
        {
            if
(pBtn->GetCheck()==BST_CHECKED)
            {
                pBtn->GetWindowText(szHabit);
                szHabitList += szHabit + "\r\n";
            }
        }
    }

MessageBox(szHabitList, "你的爱好");