Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

CTreeCtrl::GetItemRect

Call this function to retrieve the bounding rectangle for hItem and determine whether it is visible or not.

BOOL GetItemRect( 
   HTREEITEM hItem, 
   LPRECT lpRect, 
   BOOL bTextOnly  
) const;

hItem

The handle of a tree view control item.

lpRect

Pointer to a RECT structure that receives the bounding rectangle. The coordinates are relative to the upper-left corner of the tree view control.

bTextOnly

If this parameter is nonzero, the bounding rectangle includes only the text of the item. Otherwise it includes the entire line that the item occupies in the tree view control.

Nonzero if the item is visible, with the bounding rectangle contained in lpRect. Otherwise, 0 with lpRect uninitialized.

HTREEITEM hmyItem = m_TreeCtrl.GetSelectedItem();

// Dump the bounds of hmyItem. 
if (hmyItem != NULL)
{
   RECT r;

   m_TreeCtrl.GetItemRect(hmyItem, &r, FALSE);

   TRACE(TEXT("left = %d, top = %d, right = %d, bottom = %d\r\n"),
      r.left,
      r.top,
      r.right,
      r.bottom);
}

Header: afxcmn.h

Show:
© 2015 Microsoft