Export (0) Print
Expand All
0 out of 7 rated this helpful - Rate this topic

Adding Columns to the Control (Report View) 


The following procedure applies to either a CListView or CListCtrl object.

When a list control is in report view, columns are displayed, providing a method of organizing the various subitems of each list control item. This organization is implemented with a one-to-one correspondence between a column in the list control and the associated subitem of the list control item. For more information on subitems, see Adding Items to the Control. An example of a list control in report view is provided by the Details view in Windows 95 and Windows 98 Explorer. The first column lists folder, file icons, and labels. Other columns list file size, file type, date last modified, and so on.

Even though columns can be added to a list control at any time, the columns are visible only when the control has the LVS_REPORT style bit turned on.

Each column has an associated header item (see CHeaderCtrl) object that labels the column and allows users to resize the column.

If your list control supports a report view, you need to add a column for each possible subitem in a list control item. Add a column by preparing an LV_COLUMN structure and then making a call to InsertColumn. After adding the necessary columns (sometimes referred to as header items), you can reorder them using member functions and styles belonging to the embedded header control. For more information, see Ordering Items in the Header Control.


If the list control is created with the LVS_NOCOLUMNHEADER style, any attempt to insert columns will be ignored.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.