-
Text Editor Colours
Hey everybody, I have a simple text Editor.NET in C#.
How can I make certain words be coloured, for an example text editors for programming a certain language will colour words such as "while" and "if".
My problem is that I have no idea of where to start.
Thanks in ADVANCE,
David
-
Create your own RTF control or use the existing one. I'm not sure the existing one actually supports text colors but you could derive your own custom control from the base to get a good start.
-
The existing one does support text coloring, but you have to understand the RTF format.
-
Nice. The RichEdit control is one I haven't used much but probably will be using when I support scripting in my 'game' editor. So you could do syntax highlighting in that control? I guess if it supports RTF then it could do that.
I believe the OP's question has been answered then.
-
It does support. This is kind of a common question and they should really have provided an easier way. I believe the way you do it is by selecting a text and changing the selected text's highlight color but it can get tricky to actually make it stay a certain color.
They are examples if you google it. I use to have some code, but I migrated it to WPF so only have for that RichTextBox.
-
Download details: Word 2007: Rich Text Format (RTF) Specification, version 1.9.1
It's a bit long winded (270 pages) but covers all aspects of RTF formatting and leaves no question unanswered.