简体   繁体   中英

How to automatically color text depending by programming language in C# richtextbox?

Maybe my question already have posted previously but I didn't find.

I have WinForm (C#) and I put a richtextbox.

I want to paste a SQL code and I want that reserved keywords from pasted text to be colored in blue or other specific color for reserved keyword.

How to achieve this in C# code if is possible ?

You're looking for something called syntax highlighting. There are multiple libraries available to do this, but i would recommend taking a look at http://colorcode.codeplex.com/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM