本文介绍了多色文本框C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要显示2色在文本框中的文字,例如1号线红2蓝,如果我用 name.ForeColor = Color.Red;
所有文字改变颜色,但是我想,这将改变只有1线的颜色
I want show text in textbox in 2 colors, for example 1 line red 2 blue, if I use name.ForeColor = Color.Red;
all text change color, but I want that will change only 1 line color.
推荐答案
您需要使用的。
您可以然后更改文本颜色通过选择文本,并更改选择的颜色或字体。
You can then change the textcolor by selecting text and changing the selection color or font.
richTextBox1.SelectionFont = new Font("Verdana", 12, FontStyle.Bold);
richTextBox1.SelectionColor = Color.Red;
这篇关于多色文本框C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!