Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello,

 

I think this will be an easy question to answer for an experienced .NET programmer.

 

Can you change the colour of the text in a textbox that disabled? I have a light grey background to the text box which makes the text very difficult to read.

 

Any help will be very much appreciated,

 

Harold Clements

  • 2 weeks later...
Posted
Hello,

 

I think this will be an easy question to answer for an experienced .NET programmer.

 

Can you change the colour of the text in a textbox that disabled? I have a light grey background to the text box which makes the text very difficult to read.

 

Any help will be very much appreciated,

 

Harold Clements

 

Hi Harold

 

Instead of setting the TextBox to Disabled, set it to ReadOnly, then you can set the BackColor of the TextBox to White and the ForeColor to Black and it will look like a "Normal" TextBox.

  • Leaders
Posted

ReadOnly would be preferable if you want the user to be able to copy the text (or if you dont care). However, if, for some reason, you don't want the user the be able to copy text, I don't believe that the .Net framework provides a method for changing the text color, but since it will let you change the backcolor, why don't you set the backcolor to the default disabled backcolor (SystemColors.Control) when it is disabled, so that the user has a visual cue that it is disabled and the text is readable.

 

[Edit]Also, I don't know why you are changing the color of the textbox, but there is disagreement between programmers as to whether or not it is okay to override a user's color preferences. If your situation really warrants it, go ahead and change the back color. If it isn't really necessary, though, you might want to think twice before changing the colors around.[/Edit]

[sIGPIC]e[/sIGPIC]
Posted

Yeah... I think you can allways override the paint of the control evaluating if it's desabled... but I stick with marble_eater (nice nick) :D

 

Windows (and all other OS's) stand on top of standards.

Layout standards (in this case for software) are usefull so anyone who is used to work on an application, can jump to another one with no pain besides the business logic of it...

 

As everyone is used to have a grey background as standard for a desabled control, change it to yellow will be a bit confusing... don't you think?

 

Alex :p

Software bugs are impossible to detect by anybody except the end user.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...