How to Syntax Highlight in a RichTextBox [C#]?

后端 未结 6 2051
别那么骄傲
别那么骄傲 2020-12-13 20:32

How do I syntax highlight in a richtextbox control AS THE USER TYPES and USING A String[] keywords. I will be publishing a lightweight notepad to the web soon

6条回答
  •  情歌与酒
    2020-12-13 21:19

    You can change the font of selected words in the richtextbox. Take a look at the Select and SelectedFont properties of the control.

    But essentially, you need to iterate through the words, check if a word is present in your keywords, and then change the font, using the above-mentioned properties.

提交回复
热议问题