Since you are using different colors in different cells within a column, you
might consider what Joe Huber said...store the colors in the CellTags of
that column. Just to assure you, this does work well. I have done it many
times.
Here is a simple example.
Make a new project, add a ListBox and two buttons to your window.
Add a Property, StatusColor as Color
ListBox1, CellTextPaint:
PushButton1, Action event:
Dim i as Integer
For i = 0 to 30
ListBox1.AddRow Str(i)
If i Mod 2=0 then
ListBox1.CellTag(ListBox1.LastIndex, 1) = RGB(255,0,0)
Else
ListBox1.CellTag(ListBox1.LastIndex, 1) = RGB(0,255,0)
End If
Next
PushButton2, Action event:
Dim i, rowCount as Integer
StatusColor = RGB(155,155,40)
rowCount = ListBox1.ListCount - 1
For i = 0 to rowCount
If i Mod 2=0 then
ListBox1.CellTag(i, 1) = StatusColor
End If
Next
PushButton1 adds rows to the ListBox and stores in the CellTags of each row
a color you specify as an RGB value. The colors alternate between only two
colors for this project and the colors display as soon as you press this
PushButton1.
PushButton2 changes the color of every other row by changing the CellTag of
every other row to a different color.
You should be able to assign any color you want, at any time you want, based
on whatever circumstances you like and the colors should change immediately.
Notice that InvalidateCell has not been used and I did not Return True from
the CellTextPaint event.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>