展开或折叠TreeCtrl的所有节点

来源:互联网 发布:淘宝中国质造质量好吗 编辑:程序博客网 时间:2024/05/16 07:23

void ExpandBranch(HTREEITEM hItem,CTreeCtrl& tree,

                 BOOL bExpand /*=TRUE*/)

/* bExpand =TRUE 展开所有节点,否则为折叠*/

{

   if (tree.ItemHasChildren(hItem))

   {

      tree.Expand(hItem,bExpand?TVE_EXPAND:TVE_COLLAPSE);

      hItem=tree.GetChildItem(hItem);

      do {

         ExpandBranch(hItem,tree);

      } while((hItem=tree.GetNextSiblingItem(hItem))!=NULL);

   }

}

原创粉丝点击