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);
    
    	}
    }
    
  • 相关阅读:
    Vue 事件修饰符 阻止默认事件
    vue created 生命周期
    续集---网络管理常用命令
    网络管理常用命令(6/14) -netstat命令详解
    系统OOM复位定位
    nohup- Shell后台运行
    一个linux命令(6/13):traceroute命令
    一个linux命令(6/12):cat 命令
    linux命令(6/11)--修改文件的用户组chgrp和文件所有者chown
    Linux终端快捷键
  • 原文地址:https://www.cnblogs.com/ike_li/p/2852826.html
Copyright © 2011-2022 走看看