Click here to Skip to main content
14,661,175 members
Rate this:
Please Sign up or sign in to vote.
See more:
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!
Updated 18-Jul-12 14:41pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

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.[^]

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100