Click here to Skip to main content
15,882,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!
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!
Posted
Comments
[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! :(

Just check the documentation for the control's properties. In this case you can use the ForeColor[^] to set it to what you want.
 
Share this answer
 
Comments
Gabriel X 1-Aug-12 9:30am    
See http://www.codeproject.com/Answers/432703/How-to-change-a-Textboxs-selected-text-color
Hi,

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.
 
Share this answer
 
Comments
[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.
Richard!
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?

Thanks
 
Share this answer
 
Comments
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900