RichTextBox and highlighting
-
Hello, I just want to know if it's possible to do sintax highlighting with .net richtextbox without extending that class. I've seen that there're two examples on codeproject but they extend the dll, and I can't. Thanks you Bests, Paolo
-
Hello, I just want to know if it's possible to do sintax highlighting with .net richtextbox without extending that class. I've seen that there're two examples on codeproject but they extend the dll, and I can't. Thanks you Bests, Paolo
I've done quite some work with the richTextBox control that was included with .NET 2003 (so this comment doesn't apply to the 2005 version) and I can tell you that it doesn't support syntax highlighting by itself. Actually the .NET component is actually a wrapper for the good old COM-based pre-.NET RichEdit32 control. Those being said, what you could do is you could use the text changed event of the control and create your own interpretation class that you could feed the content of the control. The interpretaion class would then run through the text and *interpret* (that is, set formatting options for certain areas of the text) and set the text property of the component to the *interpreted* text. This is a solution although it may become slow as the density of the text increases. You may consider optimizing it by making a *wise* run-thtough by examinig what type of changes the text suffered... Good luck!