
Multi-line header for listview
Quote:
>>>Using the listview common control with the style set to report. Does
>>>anyone know of a way to have the column headings be multilined? Simply
>>>inserting a vbLf in the middle of the text doesn't work. I found a
>>>code example that does this in C++ using MFC, but so far have not had
>>>much luck converting the code to VB.
>>>I know I need to get to the controls message loop, no problem there. I
>>>figure I probably need to intercept the WM_PAINT message and then set
>>>the text on each column header manually.
>>>Any pointers or examples would be greatly appreciated.
>>You are correct that you need to subclass the WM_PAINT message. You
>>can set the header font to a size large enough to allow you to draw
>>the desired number of lines of text. As I recall, I had to explicitly
>>let the listview draw the text first and then override the return.
>>HTH,
>>Bryan
>Thanks Bryan, it's a start. I have no problem capturing the WM_PAINT
>message for the header control. Any hints as to what API calls I need to
>investigate to override the return after letting the listview draw the text?
In your window proc, you just call the NextWindowProc function
*before* you draw your text. This let's the listview think everything
is peachy with it's drawing so that you can come in afterward and draw
what you want.
You will probably want to use the DrawText function to draw your
header text.
HTH,
Bryan
____________________________________________________________
New Vision Software "When the going gets weird,"
Bryan Stafford "the weird turn pro."
Microsoft MVP-Visual Basic Fear and Loathing in LasVegas