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);
    
    	}
    }
    
  • 相关阅读:
    5.数组的使用,最值和反转
    4.下标越界及小结
    3.数组的三种初始化及简单内存分析
    html5版 音乐播放器
    百度网盘搜索
    HTML5扩展之微数据与丰富网页摘要
    Java 学习文章汇总
    业余草
    Catalan数
    Luogu P3004 [USACO10DEC]宝箱Treasure Chest
  • 原文地址:https://www.cnblogs.com/ike_li/p/2852826.html
Copyright © 2011-2022 走看看