CTreeCtrl::EnsureVisible
Call this function to ensure that a tree view item is visible.
BOOL EnsureVisible(
HTREEITEM hItem
);
Parameters
- hItem
Handle of the tree item being made visible.
Return Value
Returns 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.
Remarks
If necessary, the function expands the parent item or scrolls the tree view control so that the item is visible.
Example
HTREEITEM hItem = m_TreeCtrl.GetSelectedItem();
// hmyItem is the item that I want to ensure is visible.
HTREEITEM hmyItem = m_TreeCtrl.GetChildItem(hItem);
// Expand the parent, if possible.
HTREEITEM hParent = m_TreeCtrl.GetParentItem(hmyItem);
if (hParent != NULL)
m_TreeCtrl.Expand(hParent, TVE_EXPAND);
// Ensure the item is visible.
m_TreeCtrl.EnsureVisible(hmyItem);
Requirements
Header: afxcmn.h
See Also
Reference
CTreeCtrl::GetFirstVisibleItem