RichTextBox question

L

Ludwig

Goal: text that is pasted in a RichTextBox control has to be formatted
(keywords should get another forecolor/style).

My first attempt to format the text was the traditional approach of
setting SelectionStart and SelectionLength, and then setting the
SelectionColor/SelectionFont.

This works fine for small updates, but when large amount of text is
pasted it takes seconds to format the whole text; sometimes it just
hangs. This is unacceptable.

Does anyone have any insight on how this can be done without the
performance problems?

Thanks!
 
G

Galcho[MCSD.NET]

as Kevin Spencer said:
"Set the RichTextBox.SelectionColor property. Once set, the font color
will
be whatever you set it to. This applies to text that is appended to the

RichTextBox after setting the property. Otherwise, you can select text
already in the RichTextBox and set the SelectionColor to color that
text. "

I hope this helps
Galin Iliev[MCSD.NET]
www.galcho.com
 
L

Ludwig

as Kevin Spencer said:
"Set the RichTextBox.SelectionColor property. Once set, the font color
will
be whatever you set it to. This applies to text that is appended to the

RichTextBox after setting the property. Otherwise, you can select text
already in the RichTextBox and set the SelectionColor to color that
text. "

I hope this helps
Galin Iliev[MCSD.NET]
www.galcho.com


So for example I set SelectionColor to red, and append some text, set
the SelectionColor to blue, append some other text, etc...

I tried it, but performance was still extremely poor :(
 

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