这里说的选择是指具有CheckBox风格的CListCtrl控件,选中CheckBox
没有技术含量,只是刚才看见论坛里有位朋友在找,所以发到这里来,方便需要的朋友搜索.
- //以下代码中,CMyListCtrl继承自CListCtrl
- //全选
- CMyListCtrl::SelectAll()
- {
- int nCount=GetItemCount();
- for(int i=0;i<nCount;i++)
- {
- SetCheck(i,TRUE);
- }
- }
- //反选
- CMyListCtrl::InvertSelect()
- {
- int nCount=GetItemCount();
- for(int i=0;i<nCount;i++)
- {
- SetCheck(i,GetCheck(i)?FALSE:TRUE);
- }
- }