ListView Label Multi-Line


I have a listview in report-mode, with multiple columns. The columns have column header (column title). But on some columns, the column title text is too long and I want to split the text on two lines. That is, something like adding a new-line within the text of the title so that the text is displayed on two line. Yes, the height of the heading (title) row will increase.

How can I do it?

Thanks in advance,
Last edited on
The List View Control does not provide built-in support for multi-line headers; you'll have to use the custom draw mechanism (handle the NM_CUSTOMDRAW messages from the Header control.)

This article discusses how to do it using MFC (the CListCtrl class wraps the List View Control.) Unfortunately, the achive containing the example source code is corrupt.

Multiline Header Control Inside a CListCtrl

The LVM_GETHEADER message allows you to obtain the HWND to a List View control's Header control, just in case that helps.


List View


Header Control

NM_CUSTOMDRAW (header) notification code

Last edited on
Also, while it's not using a List View Header, the Microsoft Windows SDK sample MFPlayer2 shows how to handle NM_CUSTOMDRAW to draw a button in its various states.

(See ThemedButton.h and ThemedButton.cpp in the ...\multimedia\mediafoundation\MFPlayer2 subfolder of the SDK's folder.)


PS My SDK is installed in the default location (for a 32-bit computer):
C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples
Last edited on
Topic archived. No new replies allowed.