Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "win32api.inc"
#Include "richedit.inc"
#Include "CommCtrl.inc"
%IDC_ListView = 400
%IDC_Button = 401
Global hDlg, hListView As Dword, SortDirection As Long
Function PBMain() As Long
Local i As Long
Dialog New Pixels, 0, "gbSearch v1.0",300,300,400,240, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, %IDC_Button, "Colors", 10,10,100,20
Control Add ListView, hDlg, %IDC_ListView,"", 10,40,360,180
ListView Set StyleXX hDlg, %IDC_ListView, %LVS_Ex_CheckBoxes Or %LVS_Ex_GridLines Or %LVS_Ex_FullRowSelect
ListView Insert Column hDlg, %IDC_ListView, 1, "File Name", 100, 0
ListView Insert Column hDlg, %IDC_ListView, 2, "File Path", 200, 0
For i = 1 To 8
ListView Insert Item hDlg, %IDC_ListView, 10,0, "Row " + Chr$(64+i)
ListView Set Text hDlg, %IDC_ListView, i, 2, "Col2 " + "Row " + Format$(i,"00")
Next i
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local lpNmh As NmHdr Ptr
Local lpLvNm As NM_LISTVIEW Ptr
Local lpLvCd As NMLVCUSTOMDRAW Ptr
Local LVData As NM_ListView
Select Case Cb.Msg
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Button
End Select
Case %WM_Notify
Select Case Cb.NmId
Case %IDC_ListView
Select Case Cb.NmCode
Case %NM_CustomDraw
'Jose code here
lpLvCd = Cb.LParam
Select Case @lplvcd.nmcd.dwDrawStage
Case %CDDS_PREPAINT, %CDDS_ITEMPREPAINT
Function = %CDRF_NOTIFYSUBITEMDRAW
Case %CDDS_ITEMPREPAINT Or %CDDS_SUBITEM
If @lpLvCd.iSubItem = 0 Then
@lpLvCd.clrTextBk = %LtGray
@lpLvCd.clrText = %Black
Else
If (@lpLvCd.nmcd.dwItemSpec Mod 2) = 0 Then
@lpLvCd.clrTextBk = %White
@lpLvCd.clrText = %Black
Else
@lpLvCd.clrTextBk = %rgb_LightGreen
@lpLvCd.clrText = %Black
End If
End If
Function = %CDRF_NEWFONT
End Select
'end of Jose code
End Select
End Select
End Select
End Function
'gbs_00995
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm