RichTextBox very slow

  • Thread starter Thread starter kelvin.koogan
  • Start date Start date
K

kelvin.koogan

I'm using a RichTextBox in a protocol analyser I'm developing. However
as the amount of data gets large, e.g. 500000 lines, the control
becomes very slow.

For example if I load in a saved file it can take 30 seconds just to
transfer data from a StringBuilder to the RichTextBox, even with
updates turned off with WM_SETREDRAW.

Also I highlight a line when the users clicks on it and this can be
slow, as can be highlighting all instances of a string match.

Is there any way to make actions like adding text to a RichTextBox or
highlighted portions of text any faster?

TIA,
KK
 
I'm using a RichTextBox in a protocol analyser I'm developing. However
as the amount of data gets large, e.g. 500000 lines, the control
becomes very slow.

For example if I load in a saved file it can take 30 seconds just to
transfer data from a StringBuilder to the RichTextBox, even with
updates turned off with WM_SETREDRAW.

Also I highlight a line when the users clicks on it and this can be
slow, as can be highlighting all instances of a string match.

Is there any way to make actions like adding text to a RichTextBox or
highlighted portions of text any faster?

You can write the RTF code directly instead of selecting text and changing
its properties via the 'Selection*' properties. However, I wonder how a
user should be able to deal with 500,000 lines of text. Maybe you should
consider implementing a paging mechanism or something similar.
 
You can write the RTF code directly instead of selecting text and changing
its properties via the 'Selection*' properties.  

I'm sorry I don't understand what you mean, could you explain a little
more please?
However, I wonder how a
user should be able to deal with 500,000 lines of text.  Maybe you should
consider implementing a paging mechanism or something similar.

I have considered this but it seems like a lot of work and my
timescales are very tight. Is there any simple way to do this?

TIA,
KK
 
Back
Top