On Vista, the resized header eats into the rows of the ListIcon Netmaestro.
Code: Select all
Procedure HDProc(hwnd, msg, wparam, lparam)
Protected *hdlayout.HD_LAYOUT, *rect.RECT, *windowpos.WINDOWPOS
oldproc = GetProp_(hwnd, "oldproc")
Select msg
Case #WM_NCDESTROY
RemoveProp_(hwnd, "oldproc")
Case #HDM_LAYOUT
result = CallWindowProc_(oldProc, hwnd, msg, wParam, lParam)
*hdlayout = lParam
If *hdlayout\prc <> 0
*rect = *hdlayout\prc
*rect\top = 32
EndIf
If *hdlayout\pwpos <> 0
*windowpos = *hdlayout\pwpos
*windowpos\cy = 32
EndIf
Default
result = CallWindowProc_(oldproc, hwnd, msg, wparam, lparam)
EndSelect
ProcedureReturn result
EndProcedure
Procedure LVProc(hwnd, msg, wparam, lparam)
oldproc = GetProp_(hwnd, "oldproc")
Select msg
Case #WM_NCDESTROY
RemoveProp_(hwnd, "oldproc")
Case #WM_DRAWITEM
*dis.DRAWITEMSTRUCT = lparam
If *dis\itemstate
DrawFrameControl_(*dis\hdc,*dis\rcItem,#DFC_BUTTON, #DFCS_BUTTONPUSH|#DFCS_PUSHED)
bot=17
Else
DrawFrameControl_(*dis\hdc,*dis\rcItem,#DFC_BUTTON, #DFCS_BUTTONPUSH)
bot=16
EndIf
Select *dis\itemID
Case 0
TextOut_(*dis\hdc, *dis\rcItem\left+30, bot-14, "George", Len("George"))
TextOut_(*dis\hdc, *dis\rcItem\left+36, bot, "Bush", Len("Bush"))
Case 1
TextOut_(*dis\hdc, *dis\rcItem\left+40, bot-14, "Bill", Len("Bill"))
TextOut_(*dis\hdc, *dis\rcItem\left+30, bot, "Clinton", Len("Clinton"))
Case 2
TextOut_(*dis\hdc, *dis\rcItem\left+32, bot-14, "Albert", Len("Albert"))
TextOut_(*dis\hdc, *dis\rcItem\left+34, bot, "Gore", Len("Gore"))
EndSelect
ProcedureReturn 1
EndSelect
ProcedureReturn CallWindowProc_(oldproc, hwnd, msg, wparam, lparam)
EndProcedure
OpenWindow(0,0,0,500,400,"Multiline Listview Header",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ListIconGadget(0,30,30,300,300,"",100,#PB_ListIcon_GridLines)
SetProp_(GadgetID(0),"oldproc",SetWindowLongPtr_(GadgetID(0),#GWL_WNDPROC,@LVProc()))
AddGadgetColumn(0,1,"",98)
AddGadgetColumn(0,2,"",98)
AddGadgetItem(0, -1, "Huh? What?"+Chr(10)+"I didn't have sex!"+Chr(10)+"The sky is falling!")
header = SendMessage_(GadgetID(0),#LVM_GETHEADER,0,0)
SetProp_(header,"oldproc",SetWindowLongPtr_(header,#GWL_WNDPROC,@HDProc()))
SetWindowPos_(header,0,0,0,300,32,0)
item.HD_ITEM\mask = #HDI_FORMAT
For i=0 To 2
SendMessage_(header, #HDM_GETITEM, i, @item)
item\fmt = #HDF_OWNERDRAW
SendMessage_(header, #HDM_SETITEM, i, @item)
Next
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow