provided by: 
Originally published at Internet.comThis article describes how to add separator lines (single line or double line) to a list control derived from CListCtrl. This technique requires that the list control is owner drawn. This article also demonstrates how to prevent row selection in a list control.
How to do it?
Let's assume that we have a class TVisualListCtrl derived from CListCtrl. Objects of this class correspond to list control resources (each list control must be ownerdrawn). In order to implement support for separator lines, we have to add several features to this class.
Step 1.
Add a public enum type containing the separator line identifiers and 2 public functions for inserting a separator line and checking whether the item is separator or not. class TVisualCtrlList : public CListCtrl { public: enum ESeparator { SEPARATOR_SINGLE, SEPARATOR_DOUBLE }; ..... public: .... BOOL IsSeparator(int row); int InsertSeparator(int row, ESeparator separator = SEPARATOR_SINGLE); };
Also create 2 constant strings (within a class or as local variables in a .cpp implementation file) which are inserted into the list control. These strings have a special meaning to the class implementation since they are actually aliases to separator lines. const CString SingleSeparator = _T("--"); const CString DoubleSeparator = _T("==="); ...
Read article at Internet.com site