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.
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.
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 );
}
}
你要添加是这个 m_TreeCtrl.InsertItem(AddDepartment::tempStr,0,0,hTREEITEM);
......//增加节点
m_treeCtrl.Invalidate();