Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

C# ReadOnly Text Colour

  • 26-04-2006 02:13AM
    #1
    Moderators, Education Moderators, Technology & Internet Moderators Posts: 35,257 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,257 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, Registered Users 2 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,257 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