Does anyone know which property sets the text color for disabled control? I have to display some text in a disabled TextBox and I want to set its color to black.
Does anyone know which property sets the text color for disabled control? I have
Share
NOTE: see Cheetah’s answer below as it identifies a prerequisite to get this solution to work. Setting the
BackColorof theTextBox.I think what you really want to do is enable the
TextBoxand set theReadOnlyproperty totrue.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 theOnPaintevent.ReadOnlythough should give you the same result as!Enabledand allow you to maintain control of the color and formatting of theTextBox. I think it will also still support selecting and copying text from theTextBoxwhich is not possible with a disabledTextBox.Another simple alternative is to use a
Labelinstead of aTextBox.