Color Listbox

Homepage: XListBox - Owner-draw CListBox with selectable text and background colors

ColorLBHwnd := DllCall("AHKCtrlSupport\CreateColorLB", int, dwexStyle, int, x, int, y, int, width, int, height, int, HWND, int, nID, "Cdecl Int")
ColorLBHwnd Handle to the new control
nStyle i.e. 0x10000000
x, y top left coordinates on the dialog
Width, Height Width and Height of the control
HWND Handle of the dialog
ID Id of the new control



nRC := DllCall("AHKCtrlSupport\AddTextColorLB", int, ColorLBHwnd, str, szText, int, szcol, int, szbkcol, "Cdecl Int")

ColorLBHwnd Handle to the control
szText Text to add to the listbox
Textcolor See colorlist
Backgroundcolor See colorlist
Colorlist for text and background 0= Black
1= White
2= Maroon
3= Green
4= Olive
5= Navy
6= Purple
7= Teal
8= Silver
9= Gray
10= Red
11= Lime
12= Yellow
13= Blue
14= Fuschia
15= Aqua



Example:
; --------------- Create a Colored listbox-------------------------------
; -----------------------------------------------------------------------
x = 10
y = 380
width = 250
height = 120
nID = 101
dwexStyle = 0
ColorLBHwnd := DllCall("AHKCtrlSupport\CreateColorLB", int, dwexStyle, int, x, int, y, int, width, int, height, int, HWND, int, nID, "Cdecl Int")
if (errorlevel <> 0) || (ColorLBHwnd = 0)
{
	MsgBox error while calling CreateColorLB Errorlevel: %errorlevel% - RC: %ColorLBHwnd%
	return
}

Add2LB("Initialized", 0, 1)
Add2LB("Testmessage: Blue", 13, 1)
Add2LB("Testmessage: Yellow", 12, 3)
Add2LB("Testmessage: Silver", 8, 1)
Add2LB("Testmessage: bk Error in red", 0, 10)
Add2LB("Testmessage: bk black", 3, 0)
Add2LB("Testmessage: bk Blue", 0, 13)

return

Add2LB(szText, szcol, szbkcol)
{
  global ColorLBHwnd
    nRC := DllCall("AHKCtrlSupport\AddTextColorLB", int, ColorLBHwnd, str, szText, int, szcol, int, szbkcol, "Cdecl Int")
  if (errorlevel <> 0) || (nRC = 0)
  {
  	MsgBox error while calling AddTextColorLB Errorlevel: %errorlevel% - RC: %nRC%
  	return
  }
}
return