Question ListBox colors

cbreemer

Well-known member
Joined
Dec 1, 2021
Messages
184
Programming Experience
10+
Would it be possible to change the default colors of the WinForms Listbox ? In particular the colors of the selected item. Normally it has white text on blue background which is fine. But once you set the control to disabled the white text changes to light gray which is 100% unreadable on the unchanged blue background.
On a related note I am also trying to programmatically change the text and fore/back colors of the selected item, but I have not been able to find a way to do that.
 
Last edited:
That's not something you can change as it uses a standard Windows colour. You would have to owner-draw the items, in which case you can then draw whatever colours you want.
 
That's not something you can change as it uses a standard Windows colour. You would have to owner-draw the items, in which case you can then draw whatever colours you want.
Thanks ! Bad news though.... In Java I have used custom renderers but that was a long time ago, nowadays I can't be bothered with such hassle. Anyway the issue isn't really worth it.
Bad design also, IMO. Dimming the foreground color to gray is fine, but not when the background is blue. Maybe nobody is ever interested in looking at a disabled component's content 😉
 
The issue is that you changed the background color to blue. If you used the default Windows colors, you would have been okay since Microsoft does extensive usability testing with its default colors. They are not arbitrary. And with worst comes to worst, users have the ability to switch to a high contrast scheme for the visually impaired -- which has also gone through a lot of usability testing.
 
The issue is that you changed the background color to blue. If you used the default Windows colors, you would have been okay since Microsoft does extensive usability testing with its default colors. They are not arbitrary. And with worst comes to worst, users have the ability to switch to a high contrast scheme for the visually impaired -- which has also gone through a lot of usability testing.
Ah, but I haven't ! This is about the background color of the selected item, and it is blue out of the box. If only I knew how to change it !
 
Oh. I see. It's the case of disabling a control. I don't recall that being in the usability test suite back in the day.
 
Back
Top Bottom