Click here to Skip to main content
14,601,204 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have a Textbox in a WindowsForm project with a green backcolor.

When I select some of its text, the selection appears with blue color which is hardly distinguishable from non-selected text.

Is there any way I can change the selected text's color (and by chance, the blinking cursor's color)?

PS. I have poor knowledge about overriding properties.

Thanks for reading!
[no name] 1-Aug-12 9:50am
I am not sure but I *think* that the highlighting color is determined by the system color scheme. I am not at all sure that you can override that within an application.
Gabriel X 1-Aug-12 9:53am
I'm afraid that's the bottom line! :(
Rate this:
Please Sign up or sign in to vote.

Solution 2

Just check the documentation for the control's properties. In this case you can use the ForeColor[^] to set it to what you want.
Gabriel X 1-Aug-12 9:30am
Rate this:
Please Sign up or sign in to vote.

Solution 1


Is this an ASP.NET question?

I don't think you can override your OS controls. The only way I know is by rendering your own control, but creating an input from scratch is going to be a though task because you won't be able to inherit from the TextBox class.

You'll need to handle your 'input' zone, your cursor, the ability to select with the mouse and keyboard, etc.

Hope it helps.
[no name] 1-Aug-12 9:16am
Huh? He clearly stated that it's a windows forms application.
Gabriel X 1-Aug-12 9:31am
Well said!
_Zorro_ 1-Aug-12 9:37am
Indeed. My bad.
Gabriel X 1-Aug-12 9:21am
No, this is not an ASP page's input text box.
By the way, I didn't get you. Do you say I should write my control from scratch?
I think it's applicable that I change a property instead of making it from bottom to top.
Thanks for answering.
_Zorro_ 1-Aug-12 9:39am
Well, it's been a long time. Sorry if I'm wrong but yes, that's what I was saying. I'm clearly way more confortable with web applications.
Rate this:
Please Sign up or sign in to vote.

Solution 3

Thanks for the link, but I don't need to change the forecolor. The forecolor is white and I think it's fine. But I want to make the selected-text to have a color other than "blue". Do you get me?

Richard MacCutchan 1-Aug-12 11:18am
Sorry, I misread your question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100