zoukankan      html  css  js  c++  java
  • 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);
    
    	}
    }
    
  • 相关阅读:
    Atcoder Grand Contest 038 F
    洛谷 P5502
    Codeforces 1010F
    洛谷 P4621
    洛谷 P5518
    Oracle-切换当用用户的模式
    Oracle-DBV数据文件校验工具
    【转载】Oracle-通过增量备份前滚的反手解决物理备库归档缺失,损坏,gap问题
    Oracle-对比SAA与STA
    Oracle-SAA
  • 原文地址:https://www.cnblogs.com/ike_li/p/2852826.html
Copyright © 2011-2022 走看看