List views
List-view controls display items in four different views. The control's
window style specifies the current view. Additional window styles specify the
alignment of items and control-specific features. The following table describes
the four views.
| View Name |
Description |
Image |
| Icon view |
Specified by the
LVS_ICON
window style. Each item appears as a full-sized icon with a label below
it. The user can drag the items to any location in the list-view window. |
 |
| Small icon view |
Specified by the
LVS_SMALLICON
window style. Each item appears as a small icon with the label to the
right of it. The user can drag the items to any location. |
 |
| List view |
Specified by the
LVS_LIST
window style. Each item appears as a small icon with a label to the
right of it. Items are arranged in columns and the user cannot drag them
to an arbitrary location. |
 |
| Report view |
Specified by the
LVS_REPORT
window style. Each item appears on its own line, with information
arranged in columns. The leftmost column is always left justified and
contains the small icon and label. Subsequent columns contain subitems
as specified by the application. Each column has a header, unless you
also specify the
LVS_NOCOLUMNHEADER
window style. |
 |
You can change the view type after you create a list-view control. To
retrieve and change the window style, use the
GetWindowLong
and
SetWindowLong
functions. To determine the window styles of the current view, use the
LVS_TYPEMASK
value.
You can control the way items are arranged in icon or small icon view by
specifying either the
LVS_ALIGNTOP
(default) or
LVS_ALIGNLEFT
window style.
You can change the alignment after you create a list-view control. To
determine the current alignment, use the
LVS_ALIGNMASK
value.
Styles
- No button like header. Column headers are not displayed in report view. By default, columns have headers in report view.
- Auto arrange. Icons are automatically kept arranged in icon and
small icon view.
- Single line label text. Item text is displayed on a single line in
icon view. By default, item text may wrap in icon view.
- Owner draw fixed. The owner window can paint items in report view.
The list-view control sends a
WM_DRAWITEM
message to paint each item; it does not send separate messages for each
subitem. The iItemData member of the
DRAWITEMSTRUCT
structure contains the item data for the specified list-view item.
- Share image lists. The image list will not be deleted when the
control is destroyed. This style enables the use of the same image lists
with multiple list-view controls.
- Edit labels. Item text can be edited in place. The parent window
must process the
LVN_ENDLABELEDIT
notification message.
- No scroll. Scrolling is disabled. All items must be within the
client area. This style is not compatible with the
LVS_LIST
or
LVS_REPORT
styles.
- Sort. Can be one of: none (no sort), ascending or descending.