Listview header with 2 lines

Started by Haakon Birkeland, January 22, 2006, 04:31:28 PM

Previous topic - Next topic

Haakon Birkeland

Is ther a way to make the listview column header a 2 liner?

thanx
bert
Haakon 8o)

TechSupport

I don't think so in Win32. I have seen some examples in .Net.

Haakon Birkeland

Haakon 8o)

Philipp Emanuel Weidmann

This is just guesswork but you might want to try it:

- Send the LVM_GETHEADER message to the listview to obtain the header's handle
- Resize the header control using SetWindowPos to make it high enough for two lines
- Send the HDM_SETITEM message to the header control for each item (part) of the header using the HDI_FORMAT mask and the HDF_OWNERDRAW style in the fmt member of the HDITEM structure
- You can now process WM_DRAWITEM messages sent to the header's parent window (which is probably the ListView control, so you might have to subclass it first) and draw the header's items in any way you want, including multiple text lines, different text colors etc.

I haven't tried it but I think it should work. MSDN is your best friend when working it out.

Cheers,
Philipp