Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the system color of disabled text?

Tags:

I have a control that doesn't have Disabled/Enabled support for text, so I need to build that into it.

The question is simply this: If I want to pick the right system color so that this control has the same color of its disabled text as neighboring disabled labels, which system color should I pick? I've tried a few and none seem right, they're either a bit too light or a bit too dark.

In other words, suppose the ForeColor property is present, what should I write here:

myDefunctLabel.ForeColor = SystemColors.???; 
like image 616
Lasse V. Karlsen Avatar asked Oct 14 '11 10:10

Lasse V. Karlsen


People also ask

What is the disabled color code?

The background color for a disabled input in chrome is rgb(235,235,228) if that helps .. In firefox the disabled input background-color is F0F0F0.

What is disabled text?

The disabled property sets or returns whether a text field is disabled, or not. A disabled element is unusable and un-clickable. Disabled elements are usually rendered in gray by default in browsers.

How do I change the color of a disabled text box?

I think what you really want to do is enable the TextBox and set the ReadOnly property to true . It's a bit tricky to change the color of the text in a disabled TextBox . I think you'd probably have to subclass and override the OnPaint event. ReadOnly though should give you the same result as !


1 Answers

SystemColors.ControlDark looks good on my screen. And this is from actually trying them. I tried most of the others and the shade is wrong.

But according to the docs, GrayText is the one you need. Bear in mind I tried my sample on Windows 7 with Aero enabled, not sure if screen themes plays silly with the colouring here.

like image 144
Adam Houldsworth Avatar answered Oct 07 '22 07:10

Adam Houldsworth