Udostępnij za pośrednictwem


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;

Parameters

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

Return Value

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

Example

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);
}

Requirements

Header: afxcmn.h

See Also

Reference

CTreeCtrl Class

Hierarchy Chart

CTreeCtrl::GetVisibleCount

CTreeCtrl::GetNextVisibleItem

CTreeCtrl::GetPrevVisibleItem

CTreeCtrl::EnsureVisible

Other Resources

CTreeCtrl Members