RTF in RichTextBox

K

Kelvin

I am writing a protocol analyser which adds each message as it comes
in to a RichTextBox. I want to be able to highlight some elements in
colour. Using select and then SelectionColor is too slow so I was
thinking of trying to add the signals as RTF with relevant colour tags
embedded. However I'm having problems concatenating the RTF. Added
first signal is fine, but second one doesn't appear. Tried doing Rtf
+= newString and SelectionStart = int::MaxValue-1; SelectedRtf =
newString but neither works. It could be a problem with the format of
my newString, not sure.

Anyone got anything like this to work?

Using .NET 2.0, C++/CLI.

TIA,
KK
 
M

Morten Wennevik [C# MVP]

Hi Kelvin,

If you show us your code we may be able to give a better answer.

You can generally manipulate the rtf freely, provided you already have the
color defined you can just add \cf#_words\cf0_ to add color to 'words'. # is
the color index, beginning at 1, cf0 resets the color. _ is a blank space
necessary after all the rtf codes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top