Export (0) Print
Expand All
MFC
Expand Minimize

CListCtrl::GetItemPosition 

Retrieves the position of a list view item.


BOOL GetItemPosition(
   int nItem,
   LPPOINT lpPoint 
) const;

Parameters

nItem

The index of the item whose position is to be retrieved.

lpPoint

Address of a POINT structure that receives the position of the item's upper-left corner, in view coordinates.

Nonzero if successful; otherwise zero.

// The pointer to my list view control.
extern CListCtrl* pmyListCtrl;
POINT pt;

// Move all items in the list control 100 pixels to the right.
UINT i, nCount = pmyListCtrl->GetItemCount();

for (i=0;i < nCount;i++)
{
   pmyListCtrl->GetItemPosition(i, &pt);
   pt.x += 100;
   pmyListCtrl->SetItemPosition(i, pt);
}

Community Additions

ADD
Show:
© 2014 Microsoft