I want to create a simple editor like Notepad++ with simple functionality… I need to color a specific word in the rich text box area. How can I do that?
For example: when the user write these word, I want to color them to the blue color. These words are: for, while, if, try, etc.
How can I make the richtextbox to select a specific word and then color them?
And, if I want to make a comment and color everything after the //, how is that done in the richtextbox?
How do I number the line in the text box, so I can now the line number when I’m coding in my editor?
Here’s some code you can build on in order to achieve the functionality you want.
The CodeProject article Enabling syntax highlighting in a RichTextBox shows how to use RegEx in a RichTextBox to perform syntax highlighting. Specifically, look at the
SyntaxRichtTextBox.csfor the implementation.