首页 > 其他 > 详细

CheckListBox

时间:2014-03-21 14:42:42      阅读:417      评论:0      收藏:0      [点我收藏+]

 

 

实现过程


    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);
}

 

 

bubuko.com,布布扣


备注

 

关键点

 

相关链接

相关链接    相关链接

相关链接    相关链接

 




附件列表

    CheckListBox,布布扣,bubuko.com

    CheckListBox

    原文:http://www.cnblogs.com/xe2011/p/3615740.html

    (0)
    (0)
       
    举报
    评论 一句话评论(0
    关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
    © 2014 bubuko.com 版权所有
    打开技术之扣,分享程序人生!