Hopefully someone can use this. A while back I was trying to figure out how to change the colors of individual listview items.
I took information from Here which borrowed information from SKAN's dropbox and came up with this.
#SingleInstance,Force Gui, +LastFound Gui, Add, ListView, x5 y5 w200 h200 vLV_Sample hwndlv,index|day lv:=new ListView(lv) LV.Add("",1,"Monday") LV.Add("",2,"Tuesday") LV.Add("",3,"Wednesday") LV.Add("",4,"Thursday") LV.Add("",5,"Friday") LV.Add("",6,"Saturday") LV.Add("",7,"Sunday") Gui,Show,x50 y50 w210 h210 Loop,2 LV_ModifyCol(A_Index,"AutoHdr") Loop,5 { Loop,7 { lv.Color(A_Index,0xff00ff,0) WinSet,Redraw,,A sleep,100 lv.clear() } Loop,5 { lv.Color(7-A_Index,0xff00ff,0) WinSet,Redraw,,A sleep,100 lv.clear() } } WinSet,Redraw,,A Return GuiClose: GuiEscape: Exitapp class ListView{ static list:=[] __New(hwnd){ this.list[hwnd]:=this OnMessage(0x4e,"WM_NOTIFY") this.hwnd:=hwnd this.control:=[] } add(options,items*){ Gui,ListView,% this.hwnd for a,b in items{ if A_Index=1 item:=LV_Add(options,b) Else LV_Modify(item,"col" A_Index,b) } } clear(){ this.control:=[] } Color(item,fore="",back=""){ LV_GetText(text,item) if fore!="" this.Control[text,"fore"]:=fore if Back!="" this.Control[text,"back"]:=back } } WM_NOTIFY(Param*){ Critical control:= if (this:=ListView.list[NumGet(Param.2)])&&(NumGet(Param.2,2*A_PtrSize,"int")=-12){ stage:=NumGet(Param.2,3*A_PtrSize,"uint") if (stage=1) return 0x20 ;sets CDRF_NOTIFYITEMDRAW if (stage=0x10001){ ;NM_CUSTOMDRAW && Control is in the list index:=numget(Param.2,A_PtrSize=4?9*A_PtrSize:7*A_PtrSize,"uint") LV_GetText(text,index+1) info:=this.Control[text] if info.fore!="" NumPut(info.fore,Param.2,A_PtrSize=4?12*A_PtrSize:10*A_PtrSize,"int") ;sets the foreground if info.back!="" NumPut(info.back,Param.2,A_PtrSize=4?13*A_PtrSize:10.5*A_PtrSize,"int") ;sets the background } } }
this will highlight by the second column.
Let me know if this is helpful to you.
The colors are based off of the first column of the listviews text value. to change that you can just change the two LV_GetText() values
LV_GetText(text,item,2) and LV_GetText(text,item+1,2)