DesktopListBox Color Text and background

Windows 11 - XOJO 26r2.1
I have a DesktopListBox that has different colors for specific rows.
When selecting a row, there are some colors where the text is no longer clearrly visible.
What I would like to achive is that when a row is selected the text becomes white with a blue background like the default value for a selected row.
Once the selecting changes it need to return to its previous color.

Is that possible ?

Thanks
Regards
Etienne

You’re already implementing the PaintCellBackground event of your listbox to handle changing the row background colors.

Now you’ll need to implement the PaintCellText event to handle the font colors.

If you just want to change the text color for the whole cell, you don’t even need to draw the text yourself. In the PaintCellText event, create an if or select block to narrow down the change to just the cells you want. Set g.Forecolor to a color and Return False, the framework will then draw the text in your chosen color in that cell.

Thanks Christian for the reply.
I will take a look at it.