CellTextPaint not firing

Thanks everyone!

Well, now that I’ve got some nice color text in my cells, I’ve noticed that the text isn’t turning white when selected. I’ve tried a couple of fixes in the CellTextPaint event, but they cause the text to turn white when clicked, but then they stay white after not selected anymore, becoming invisible. Selecting multiple rows has even more bizarre behavior.

Here’s what I’ve tried.

If row=DroppedRow Then
  g.forecolor=RGB(255,255,255)
  g.DrawString(Me.Cell(row, column), x, y) 
  Return True  
End If


If Me.Cell(row, column) = "Test" Then
  g.forecolor=RGB(0,0,255)
End If

If Me.Cell(row, column) = "Test2" Then
  g.forecolor=RGB(0,0,255)
End If

If Me.Cell(row, column) = "Test3" Then
  g.forecolor=RGB(0,0,255)
End If

If Me.Cell(row, column).beginswith("S") Then
  g.forecolor=RGB(0,128,0)
End If

If Me.Cell(row, column) = "Name" Then
  g.forecolor=RGB(255,0,0)
End If


For X3 As Integer = SCRIPT_LISTBOX.ListCount-1 DownTo 0 
If SCRIPT_LISTBOX.Selected(X3) Then 
g.forecolor=RGB(255,255,255)
End If 
Next X3




Also tired this instead of the last part

for each row2 as ListboxRow in SCRIPT_LISTBOX.Rows
  if row2.Selected then
    g.forecolor=RGB(255,255,255)
  end
  if row2.Selected = False then
  end
next

Try

If  Not me.Selected(row) AND  Me.Cell(row, column) = "Test" Then
  g.forecolor=RGB(0,0,255)
End If

-Karen

1 Like

Perfect. Absolutely perfect.

Thanks Karen!!!