如何更改文本框的选定文本颜色? [英] How to change a Textbox's selected text color?

查看:317
本文介绍了如何更改文本框的选定文本颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!
我在WindowsForm项目中有一个带有绿色背景色的文本框.

当我选择其中的一些文本时,所选内容将显示为蓝色,这与未选择的文本几乎无法区分.

有什么办法可以更改所选文本的颜色(以及偶然的光标闪烁颜色)?

PS.我不太了解覆盖属性.

感谢您的阅读!

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!

推荐答案

只需检查文档中控件的属性.在这种情况下,您可以使用 ForeColor [
Just check the documentation for the control''s properties. In this case you can use the ForeColor[^] to set it to what you want.




这是一个ASP.NET问题吗?

我认为您无法覆盖操作系统控件.我知道的唯一方法是呈现自己的控件,但是从头开始创建输入将是一项艰巨的任务,因为您将无法从TextBox类继承.

您需要处理输入"区域,光标,使用鼠标和键盘进行选择的能力等.

希望对您有所帮助.
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.


Richard!
感谢您的链接,但是我不需要更改原色.前景色是白色的,我认为很好.但是我想使所选文本具有除蓝色"以外的其他颜色.你懂我吗?

谢谢
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


这篇关于如何更改文本框的选定文本颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆