[原创][分享]CTreeCtrl的递归算法应用
/*姬昂于2004-10月添加递归算法,实现树控件的全选,反选,取消的集合操作*/void CXmRecive::RetrievesAllSiblingTreeSetCheck(CTreeCtrl* pTreeCtrl/* = NULL */,
HTREEITEM Item/* = NULL */,
BOOL IsSelected/* = FALSE */,
BOOL IsReverse/* = FALSE*/)
{
if (!Item)
return ;
if (!IsReverse)
pTreeCtrl->SetCheck(Item,IsSelected);
else
pTreeCtrl->SetCheck(Item,!pTreeCtrl->GetCheck(Item));
RetrievesAllSiblingTreeSetCheck(pTreeCtrl,pTreeCtrl->GetChildItem(Item),IsSelected,IsReverse);
RetrievesAllSiblingTreeSetCheck(pTreeCtrl,pTreeCtrl->GetNextSiblingItem(Item),IsSelected,IsReverse);
}