Is it possible to change the color of the “bar” when we select a row in a listbox?
Yes. It’s very easy to find in the documentation.
Okay Tim…I’ll see there.
Something like this in CellBackgroundPaint:
If row = Me.ListIndex Then
g.ForeColor = RGB(255, 0, 0)
g.FillRect(0, 0, g.Width, g.Height)
Return True
End If
Depending on the color, you might want to change the text color as well.
In CellTextPaint:
If row = Me.ListIndex Then
g.ForeColor = RGB(255, 255, 0)
g.DrawString(Me.Cell(row, column), 0, 0)
End If
Thanks a lot, Marco!! Great!
That code assumes you don’t have multiple selection enabled for the listbox. Best to check Listbox.Selected(row) to make the code more general.
- Karen
Thanks a lot, Karen.