zoukankan      html  css  js  c++  java
  • C++ CheckListBox

     

     

    实现过程


        CCheckListBox    listbox1;

     

        listbox1.AddString("葡萄");
        listbox1.AddString("苹果");

        listbox1.AddString("桔子");

    //判断你选择了哪些项目

    void CCheckListBoxDlg::OnButtonOk() 
    {
        // TODO: Add your control notification handler code here
        CString strTextstrItem;
        int nSelCount = 0i = 0;
        
        strText = "您已经选择了:";
        int nCount = listbox1.GetCount();
        for(i = 0i < nCounti++)
        {
            if(listbox1.GetCheck(i))
            {
                nSelCount++;
            }
        }
        if(nSelCount <= 0)
        {
            AfxMessageBox("请选择一种水果。");
            return;
        }
        int nStep = 0;
        for(i = 0i < nCounti++)
        {
            if(listbox1.GetCheck(i))
            {
                listbox1.GetText(istrItem);
                strText += strItem;
                nStep++;
                if(nStep == nSelCount)
                {
                    strText += "。";
                }
                else
                {
                    strText += ",";
                }
            }
        }
        AfxMessageBox(strText);
    }

     

     


    备注

     

    关键点

     

    相关链接

    相关链接    相关链接

    相关链接    相关链接

     




    附件列表

    • 相关阅读:
      2021.3.3
      2021.3.2
      2021.3.1
      2021.2.28(每周总结)
      2021.2.27
      2021.2.26
      2021.2.25
      2021.2.23
      Redis系统学习之五大基本数据类型(List(列表))
      Redis系统学习之五大基本数据类型(String(字符串))
    • 原文地址:https://www.cnblogs.com/xe2011/p/3615740.html
    Copyright © 2011-2022 走看看