Dela via


CMFCHeaderCtrl Class

The CMFCHeaderCtrl class supports sorting multiple columns in a header control.

class CMFCHeaderCtrl : public CHeaderCtrl

Members

Public Constructors

Name

Description

CMFCHeaderCtrl::CMFCHeaderCtrl

Constructs a CMFCHeaderCtrl object.

CMFCHeaderCtrl::~CMFCHeaderCtrl

Destructor.

Public Methods

Name

Description

CMFCHeaderCtrl::EnableMultipleSort

Enables or disables multiple column sort mode for the current header control.

CMFCHeaderCtrl::GetColumnState

Indicates whether a column is not sorted, or is sorted in ascending or descending order.

CMFCHeaderCtrl::GetSortColumn

Retrieves the zero-based index of the first sorted column in the header control.

CMFCHeaderCtrl::GetThisClass

Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.

CMFCHeaderCtrl::IsAscending

Indicates whether any column in the header control is sorted in ascending order.

CMFCHeaderCtrl::IsDialogControl

Indicates whether the parent window of the current header control is a dialog box.

CMFCHeaderCtrl::IsMultipleSort

Indicates whether the current header control is in multiple column sort mode.

CMFCHeaderCtrl::RemoveSortColumn

Removes the specified column from the list of sort columns.

CMFCHeaderCtrl::SetSortColumn

Sets the sort order of a specified column in a header control.

Protected Methods

Name

Description

CMFCHeaderCtrl::OnDrawItem

Called by the framework to draw a header control column.

CMFCHeaderCtrl::OnDrawSortArrow

Called by the framework to draw the sort arrow.

CMFCHeaderCtrl::OnFillBackground

Called by the framework to fill the background of a header control column.

Example

The following example demonstrates how to construct an object of the CMFCHeaderCtrl class, and how to enable multiple column sort mode for the current header control.

 CMFCHeaderCtrl* headerCtrl = new CMFCHeaderCtrl();
    headerCtrl->EnableMultipleSort();

Remarks

The CMFCHeaderCtrl class draws a sort arrow on a header control column to indicate that the column is sorted. Use multiple column sort mode if a set of columns in the parent list control (CMFCListCtrl Class) can be sorted at the same time.

Inheritance Hierarchy

CObject

   CCmdTarget

      CWnd

         CHeaderCtrl

            CMFCHeaderCtrl

Requirements

Header: afxheaderctrl.h

See Also

Concepts

MFC Hierarchy Chart

Reference

CMFCListCtrl Class

Other Resources

Classes (MFC Feature Pack)