Partager via


CTreeCtrl::SelectSetFirstVisible

Call this function to scroll the tree view vertically so that the given item is the first visible item.

BOOL SelectSetFirstVisible(
   HTREEITEM hItem 
);

Parameters

  • hItem
    Handle of the tree item to be set as the first visible item.

Return Value

Nonzero if successful; otherwise 0.

Remarks

The function sends a message to the window with the TVM_SELECTITEM and TVGN_FIRSTVISIBLE message parameters.

Example

// Select the item at the point myPoint as the first visible item.
UINT uFlags;
HTREEITEM hItem = m_TreeCtrl.HitTest(myPoint, &uFlags);

if ((hItem != NULL) && (TVHT_ONITEM & uFlags))
{
   m_TreeCtrl.SelectSetFirstVisible(hItem);
}

Requirements

Header: afxcmn.h

See Also

Concepts

CTreeCtrl Class

CTreeCtrl Members

Hierarchy Chart

CTreeCtrl::Select

CTreeCtrl::SelectItem

CTreeCtrl::SelectDropTarget