Here is a Listview Demo project that has a multi-Line header.
The original code was By Jules Marchildon April/2002 and Inspired by Mark Newman
James
I don't use Jose Includes and the custom options in the AppStart stopped it from compiling too. After I remove that it compiles, but the column headers are blank except one word in Blue about 3/4 the way into the columns.
Hello James,
Thank you for this demo; but on my system I can't see the multi-line header.
See the screenshot.
Jean-Pierre
No Idea what the problem is.
OS here is Win7(64)
James
No headers here either...
It works if I disable the "Theme support" for the project.
Jean-Pierre
Quote from: Jean-Pierre Leroy on February 15, 2010, 06:27:39 PM
It works if I disable the "Theme support" for the project.
See - told you (in the other thread about customdraw and XP Themes.
Using a big font to increase the header height is a hack that doesn't work with XP themes.
A more straightforward way is to process the HDM_LAYOUT message, fill the WINDOWPOS structure with the appropriate size and position of the header control, and change the top position of the rectangle that the header control will occupy.
CASE %HDM_LAYOUT
LOCAL phdl AS HDLAYOUT PTR
phdl = lParam
@phdl.@pwpos.hwnd = hwnd
@phdl.@pwpos.flags = %SWP_FRAMECHANGED
@phdl.@pwpos.x = @phdl.@prc.nLeft
@phdl.@pwpos.y = 0
@phdl.@pwpos.cx = @phdl.@prc.nRight - @phdl.@prc.nLeft
@phdl.@pwpos.cy = 40 ' --> change me
@phdl.@prc.nTop = 40 ' --> change me
FUNCTION = -1
EXIT FUNCTION
Attached to this post you will find a modified version of Jules' example.
In the James' example, change:
Function HeaderProc( ByVal hWndControl As Dword, _
ByVal wMsg As Dword, _
ByVal wParam As Long, _
ByVal lParam As Long _
) As Long
Local hFont As Long
Select Case wMsg
Case %WM_SIZE
hFont = FF_MakeFontEX("Tahoma",%HEADER_HEIGHT,0,0,0,0)
SendMessage hWndControl,%WM_SETFONT,hFont,1
DeleteObject hFont
Case %WM_LBUTTONDBLCLK
PostMessage hWndControl,%WM_LBUTTONDOWN,wParam,lParam
Function = 0
Exit Function
End Select
Function = FF_SubClassOrig(hWndControl,wMsg,wParam,lParam)
End Function
to:
Function HeaderProc( ByVal hWndControl As Dword, _
ByVal wMsg As Dword, _
ByVal wParam As Long, _
ByVal lParam As Long _
) As Long
Select Case wMsg
Case %WM_LBUTTONDBLCLK
PostMessage hWndControl,%WM_LBUTTONDOWN,wParam,lParam
Function = 0
Exit Function
CASE %HDM_LAYOUT
LOCAL phdl AS HDLAYOUT PTR
phdl = lParam
@phdl.@pwpos.hwnd = hWndControl
@phdl.@pwpos.flags = %SWP_FRAMECHANGED
@phdl.@pwpos.x = @phdl.@prc.nLeft
@phdl.@pwpos.y = 0
@phdl.@pwpos.cx = @phdl.@prc.nRight - @phdl.@prc.nLeft
@phdl.@pwpos.cy = 120 ' --> change me
@phdl.@prc.nTop = 120 ' --> change me
FUNCTION = -1
EXIT FUNCTION
End Select
Function = FF_SubClassOrig(hWndControl,wMsg,wParam,lParam)
End Function
Jose,
Thank you very much.
James