Change enable=false forecolor

  • Thread starter Thread starter Stephen
  • Start date Start date
S

Stephen

greeting folks

I would like to change the foreground color for a disabled textbox from the
dimmed gray to something else that is easlier readable. I can change the
background using the following:
textbox1.BackColor = System.Drawing.SystemColors.Control.White

however i cant for the life of me figure out the foreground . any help would
be appreciated



steve
 
Hey Stephen,

I had the same problem.
Since then, I use the ReadOnly-properth in stead of the Enabled.
If ReadOnly is set to true, the forecolor can be changed!
Maybe this helps you???

Regards,

Q
 
Q said:
Since then, I use the ReadOnly-properth in stead of the Enabled.
If ReadOnly is set to true, the forecolor can be changed!

This doesn't work on my machine running .NET 1.1 SP1, Windows XP
Professional SP2. Using a richtextbox instead of the textbox will allow you
to set the forecolor even if the textbox is disabled or read-only.
 
excellent idea, i didnt think about that. i need to be able to change the
foreground to different colors depending on criteria in the app.... do u
have a example ?

again thanks
stephen
 
Hey again Stephen,

here's the example you asked for!

Regards,

Q

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
MyTextbox.BackColor = System.Drawing.Color.Green
MyTextbox.ForeColor = System.Drawing.Color.White
End Sub
 
Back
Top