What your asking is possible, but not the easiest. I would look up other richTextBoxes, they are easier to work with and can provide other feutures like error underlining. Just a heads up.
Well, from my understanding you said you don't want it to editable. Simply just set the
Read-Only
property to
true
.
The coloring part is difficult, because I know that you can only change the color of a desired text part by Selecting it, Coloring it, then unselecting it. Which can be really ugly. I'm wondering if it would be easier to make your own custom control with multiple RichTextBoxes so you can just set the color of each one separately without selecting the text.
Back to the selecting part, if you were to keep one richtextbox, you're going to want to keep information for each
MyClass
containing a StartIndex and Length, so when the user clicks you can go through your list of
MyClass
's and see if it contains the cursor. This algorithm could also you used to select the whole word, that actually seems like a easy concept.
That roughly covers, what I thought you said, except for the shift-selecting which probably would be easy to figure out if you got the other concepts working first. Here are some articles explaining further in depth on RichTextBox coloring seperate texts.
Multiple Colored Texts in RichTextBox using C#[
^]
How to Change Font Color on RichTextBox after USING SPLIT[
^]
Hope this helps.