|
//展开给定根的所有子节点
void CMyTreeCtrl::ExpandAllItem(HTREEITEM hRoot, BOOL bExpand)
{
if (hRoot == NULL)
return;
if (ItemHasChildren(hRoot))
{
Expand(hRoot,bExpand?TVE_EXPAND:TVE_COLLAPSE);
hRoot=GetChildItem(hRoot);
while (hRoot!=NULL)
{
ExpandAllItem(hRoot, bExpand);
hRoot=GetNextSiblingItem(hRoot);
} // end of while(hRoot != NULL, Expand it and find next item)
} // end of if(has children)
}
|