DECLARE SUB DrawItems(Index AS LONG, State AS LONG, r AS QRECT)
DIM Colors(2) AS LONG
Colors(0)=&H0000FF
Colors(1)=&HFF0000
Colors(2)=&H00FF00
CREATE Form AS QFORM
Center
CREATE ListBox AS QLISTBOX
Style=1
AddItems "Red", "Blue", "Green"
OnDrawItem=DrawItems
END CREATE
SHOWMODAL
END CREATE
SUB DrawItems
SELECT CASE State
CASE 0:
ListBox.FillRect(r.Left, r.Top, r.Right, r.Bottom, Colors(Index))
ListBox.TextOut(r.Left, r.Top, ListBox.Item(Index), &HFFFFFF, -1)
CASE 1:
ListBox.FillRect(r.Left, r.Top, r.Right, r.Bottom, ListBox.COLOR)
ListBox.TextOut(r.Left, r.Top, ListBox.Item(Index), Colors(Index), -1)
END SELECT
END SUB
|