1.
Change the background color of individual columns
--------------------------------------------------------------------------------
To set the background color of a column, the list view control has to be owner drawn. In an owner drawn control, each row is drawn by the application program rather than by the control. So when drawing a row, the background color can be set to our choice within the rectangle occupied by a particular column. To implement an owner drawn control see the topic 'Selection highlighting of entire row'.
The code segment below illustrates how to set yellow as the background color for alternate columns. The code shown is part of the DrawItem() function. The first segment draws the background color just before drawing the state icon. The second segment draws the background color within the loop that draws the labels for the remaining columns.
// Set clip region
rcCol.right = rcCol.left + GetColumnWidth(0);
CRgn rgn;
rgn.CreateRectRgnIndirect(&rcCol);
pDC->SelectClipRgn(&rgn);
rgn.DeleteObject();
2.
m_listctrl.SetExtendedStyle(m_listctrl.GetExtendedStyle()|LVS_EX_FULLROWSELECT);
3.
Example
// The pointer to my list view control.
extern CListCtrl* pmyListCtrl;
// The new image list of the list view control.
extern CImageList* pmyImageList;//初始化中创建ICON列表