CMFCListCtrl Class
The CMFCListCtrl class extends the functionality of CListCtrl Class class by supporting the advanced header control functionality of the CMFCHeaderCtrl Class.
class CMFCListCtrl : public CListCtrl
Members
Public Methods
Name |
Description |
---|---|
Enables the ability to mark a sorted column with a different background color. |
|
Enables multiple sort mode. |
|
Returns a reference to the underlined header control. |
|
Checks if the list control is in multiple sort mode. |
|
Called by the framework when it must compare two list control items. |
|
Called by the framework when it must determine the background color of an individual cell. |
|
Called by the framework when it must obtain the font for the cell being drawn. |
|
Called by the framework when it must determine the text color of an individual cell. |
|
Removes a sort column from the list of sorted columns. |
|
Sets the current sorted column and the sort order. |
|
Sorts the list control. |
Remarks
CMFCListCtrl offers two enhancements to CListCtrl Class class. First, it indicates that column sorting is an available option by automatically drawing a sort arrow on the header. Second, it supports data sorting on multiple columns at the same time.
Example
The following example demonstrates how to use various methods in the CMFCListCtrl class. The example shows how to create a list control, insert columns, insert items, set the text of an item, and set the font of the list control. This code snippet is part of the Visual Studio Demo sample.
CMFCListCtrl m_wndWatch;
...
// DWORD dwStyle
// CRect rectDummy
m_wndWatch.Create(dwStyle, rectDummy, this, ID_LIST_1);
m_wndWatch.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
m_wndWatch.InsertColumn(0, _T("Variable"), LVCFMT_LEFT, 100);
m_wndWatch.InsertColumn(1, _T("Value"), LVCFMT_LEFT, 100);
m_wndWatch.InsertItem(0, _T("m_nCount"));
m_wndWatch.SetItemText(0, 1, _T("100"));
m_wndWatch.SetFont(&m_Font);
Inheritance Hierarchy
Requirements
Header: afxlistctrl.h