This documentation is archived and is not being maintained.


Repositions items in an icon view so that they align on a grid.

BOOL Arrange(
   UINT nCode 



Specifies the alignment style for the items. It can be one of the following values:

  • LVA_ALIGNLEFT   Aligns items along the left edge of the window.

  • LVA_ALIGNTOP   Aligns items along the top edge of the window.

  • LVA_DEFAULT   Aligns items according to the list view's current alignment styles (the default value).

  • LVA_SNAPTOGRID   Snaps all icons to the nearest grid position.

Nonzero if successful; otherwise zero.

The nCode parameter specifies the alignment style.

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

// Align all of the list view control items along the top
// of the window (the list view control must be in icon or
// small icon mode).