本文介绍了富文本框颜色不变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个应用程序,其中我必须使用行号更改RTF文本框文本的背景颜色.我已经找到行号,但是当我尝试给该行号的相应文本上色时,它不会影响那里的任何内容.我的代码如下:
Hi, I am working on one application where i have to change the background color of a Rich text Box Text using Line Number. I have found the Line Number, but when i tried to color the respective text of that line number, its not effecting any thing there. My Code is as follows:
this.RTB.Select(this.RTB.GetFirstCharIndexFromLine(lineNumber), this.RTB.Lines[lineNumber].Length); this.RTB.SelectionBackColor = Color.Red;请给我建议这段代码有什么问题. 谢谢 Shahab Abbasi
Please, suggest me what is wrong in this code. Thanks Shahab Abbasi
推荐答案请告诉我您的RichTextbox数据......... 就我而言,相同的代码正在工作,请参见 Please show me your RichTextbox Data............ In my case same code is working see here int lineNumber = 2; this.richTextBox1.Select(this.richTextBox1.GetFirstCharIndexFromLine(lineNumber), this.richTextBox1.Lines[lineNumber].Length); this.richTextBox1.SelectionBackColor = Color.Red;
更多推荐
富文本框颜色不变
发布评论