CTreeCtrl::EnsureVisible

BOOL EnsureVisible( HTREEITEM hItem );

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.

Parameters

hItem

Handle of the tree item being made visible.

Remarks

Call 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.

Example

// The pointer to my tree control.
extern CTreeCtrl* pmyTreeCtrl;
// The item that I want to ensure is visible.
extern HTREEITEM hmyItem;
   
// Expand the parent, if possible.
HTREEITEM hParent = pmyTreeCtrl->GetParentItem(hmyItem);
if (hParent != NULL)
   pmyTreeCtrl->Expand(hParent, TVE_EXPAND);

// Ensure the item is visible.
pmyTreeCtrl->EnsureVisible(hmyItem);

CTreeCtrl OverviewClass MembersHierarchy Chart

See Also   CTreeCtrl::GetFirstVisibleItem, CTreeCtrl::GetVisibleCount