如何在富文本框中为宽敞的Char宪章着色? [英] How To Color Spacific Char Charters In Rich Text Box?

查看:63
本文介绍了如何在富文本框中为宽敞的Char宪章着色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在研究一个程序,该程序以C#窗口形式显示带有所有键盘键的GUI和富文本框,
用户应该在富文本框中输入文本,然后用鼠标(例如)按下A按钮
而且所有的a字符都将是绿色,但是我不知道如何为这些特定的汽车字符着色.

Hello im working on a program that displays a gui with all the keyboard keys and a rich text box in C# windoes forms,
the user is supposed to input a text to the rich text box and then press with the mouse (for exmple) the A button
and all the a the a chars will be in green color,but i dont know how can i color those specific car charcters.

any help would be more than appreciated!

推荐答案

您将需要学习一些RTF规范.然后迭代输入文本并设置打开和关闭rtf标签以设置颜色.另外,请记住,如果添加了rtf标签,则需要验证是否已添加标签,这样就不会多次在特定字符周围添加相同的标签.

http://msdn.microsoft.com/en-us/library/aa140277(v = office.10) [ ^ ]

如果还有另一种方法,我不知道.几年来我没有使用Richtext框,所以也许还有另一种方法?
You will need to learn some RTF specifications. Then iterate the input text and set opening and closing rtf tags to set the color. Also, keep in mind that if you have added the rtf tags you will need to verify if you have already added a tag so you aren''t adding the same tags around specific characters multiple times.

http://msdn.microsoft.com/en-us/library/aa140277(v=office.10)[^]

If there is another way I am not aware of it. I haven''t used Richtext box in a couple years so maybe there is another way???


这篇关于如何在富文本框中为宽敞的Char宪章着色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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