TCheckListBox、CheckListBox

http://www.cnblogs.com/mingdep/archive/2012/03/20/2408282.html

 

   全部打勾

    for (int i = 0; i < CheckListBox1->Items->Count; i++)
    {
        CheckListBox1->Checked[i] = aflag;
    }

 

可多选,拖拉多选

    CheckListBox1->MultiSelect = true;

 

   选中的打勾

    if (CheckListBox1->SelCount > 1)
    {
        for (int i = 0; i < CheckListBox1->Items->Count; i++)
        {
            if (CheckListBox1->Selected[i])
                CheckListBox1->Checked[i] = false;
        }

    }
    else
        CheckListBox1->Checked[CheckListBox1->ItemIndex] = false;

 

posted on 2016-10-29 11:08  lypzxy  阅读(369)  评论(0编辑  收藏  举报