Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

C# ReadOnly Text Colour

Options
  • 26-04-2006 2:13am
    #1
    Moderators, Education Moderators, Technology & Internet Moderators Posts: 35,079 Mod ✭✭✭✭


    I have a textbox on my form that has the readonly property set to true. The problem is the grey colour of the text makes it harder to read the data in the text box. I was wondering if there was a way to change the colour of the text when the text box is set to readonly (or when enabled is set to false).

    Any help would be great.


Comments

  • Moderators, Education Moderators, Technology & Internet Moderators Posts: 35,079 Mod ✭✭✭✭AlmightyCushion


    Sorry had the text box disabled not readonly. I was looking at the code of a different form. Too late for this stuff.


  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    Yeah - Readonly won't (i.e. shouldn't) change the colour at all, and will still allow you to do stuff like select teh text to copy. Disabling (i.e. Enabled = false), on the other hand....does exactly what you describe.

    In both cases, you should always be able to manually set the foreground and background colours after setting the readonly/enabled. However, just one word of caution - if you use "Custom" colours, instead of the predefined ones (e.g. Window, Control, etc.), then accept that if someone is using a different colour-scheme to you, you may just have made things look awful for them.

    jc


  • Moderators, Education Moderators, Technology & Internet Moderators Posts: 35,079 Mod ✭✭✭✭AlmightyCushion


    bonkey wrote:

    if you use "Custom" colours, instead of the predefined ones (e.g. Window, Control, etc.), then accept that if someone is using a different colour-scheme to you, you may just have made things look awful for them.

    Yeah I learnt that lesson yesterday. I was putting a program on my friends laptop to demo my project and the forms I spent so long designing and giving them pretty colours were turned back to that drap grey colour. I couldn't be arsed changing all the forms so I just left them the way they were. So many hours wasted.


Advertisement