• VC++ MFC CheckBox


    MFC中复选框CheckBox的基类是CButton! 

    得到复选框状态的函数:CButton* pBtn = (CButton*)GetDlgItem(IDC_CHECK_MIXI);

               int state = pBtn->GetCheck();

               当state == 0时表示该复选框没有被选中;

               当state == 1时表示该复选框被选中;

               当state == 2时表示不确定(applies only if the button has the BS_3STATE or BS_AUTO3STATE style);

    设置复选框状态的函数:CButton* pBtn = (CButton*)GetDlgItem(IDC_CHECK_MIXI);

               pBtn->SetCheck(1);

               SetCheck(1)表示设置复选框为“选中”状态;

               SetCheck(0)表示设置复选框为“未选中”状态;

               SetCheck(2)设置复选框为不确定状态(This value can be used only if the button has the BS_3STATE or BS_AUTO3STATE style.);

    注:非0也为“选中”。

    勾选:全部选择,取消勾选:全部选择.

    void CFurtherConvertCutCodeView::OnClickedCheckSelectall()
    {	
    	// TODO: Add your control notification handler code here
    	if(BST_CHECKED==!IsDlgButtonChecked(IDC_CHECK_SelectAll))
    	{
    	
    		SelectCheckList(0);
    	}
    	else
    	{		
    		SelectCheckList(1);
    	}
    }
    
    void CFurtherConvertCutCodeView::SelectCheckList(int nCheck)
    {
    	int iSel=m_ListFiles.GetCount();
    	for(int i=0;i<iSel;i++)
    	{
    	   m_ListFiles.SetCheck(i,nCheck);
    
    	}
    }
    
  • 相关阅读:
    多样三角形
    字符串转化去重
    捕获异常里面的特殊异常
    sqlalchemy.exc.CompileError: (in table 'language_label', column 'name'): VARCHAR requires a length o
    机器学习总结
    找出两个列表中相同元素与不同元素
    正则去重
    mysql5.7 安装重置密码
    chrome快捷键
    golang select
  • 原文地址:https://www.cnblogs.com/ike_li/p/2852826.html
Copyright © 2020-2023  润新知