向选择中的一个节点增加了一子节点,增加成功了,但节点前面的+按钮没有刷新出来,用了update()也没用,要调用其它什么接口,请指教!
也就是点击保存之后树不能刷新!

解决方案 »

  1.   

    EnsureVisible
    CTreeCtrl::EnsureVisible
    BOOL EnsureVisible( HTREEITEM hItem );Return ValueReturns TRUE if the system scrolled the items in the tree-view control to ensure that the specified item is visible. Otherwise, the return value is FALSE.ParametershItemHandle of the tree item being made visible.ResCall this function to ensure that a tree view item is visible. If necessary, the function expands the parent item or scrolls the tree view control so that the item is visible.
      

  2.   

    if(tempStr != ""){    //tempStr是新加的
    HTREEITEM m_hItem;
    m_hItem = m_TreeCtrl.GetRootItem();
    for(UINT i = 0; i <= m_TreeCtrl.GetCount(); i++){
    if(m_TreeCtrl.GetItemText(m_hItem) == tempStr)
    m_TreeCtrl.DeleteItem(m_hItem);
    else
    m_hItem = m_TreeCtrl.GetNextItem(m_hItem,TVGN_NEXTVISIBLE );
    }
    }
      

  3.   

    上面的是删除的,搞错了,
    你要添加是这个 m_TreeCtrl.InsertItem(AddDepartment::tempStr,0,0,hTREEITEM);
      

  4.   

    调用Invalidate函数刷新一下就可以了~CTreeCtrl  m_treeCtrl;
    ......//增加节点
    m_treeCtrl.Invalidate();
      

  5.   

    http://download.csdn.net/source/1935761