Search code examples
c#.netwinformscontrols

Change TextColor of disabled control


How to change the color of text, when a control is disabled.I want to set different color when control is disabled in c# winforms.


Solution

  • Edit: I had made the same mistake as Cody in the comments so corrected my answer.

    It depends on which control it is.

    For example, if it's a TextBox maybe you could make it ReadOnly instead of disabled. And for some other controls you might be able to do similar things to make them appear disabled without actually being disabled.

    However, if you want to do it properly you need to make them Owner-draw or override the OnPaint event and draw the text yourself.