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
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.


Ensures that a list view item is at least partially visible.

BOOL EnsureVisible(
   int nItem,
   BOOL bPartialOK 



Index of the list view item that is to be visible.


Specifies whether partial visibility is acceptable.

Nonzero if successful; otherwise zero.

The list view control is scrolled if necessary. If the bPartialOK parameter is nonzero, no scrolling occurs if the item is partially visible.

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

// Ensure that the last item is visible.
int nCount = pmyListCtrl->GetItemCount();
if (nCount > 0)
   pmyListCtrl->EnsureVisible(nCount-1, FALSE);

Community Additions

© 2015 Microsoft