I have a program where I basically need to load Rich Text from a StringBuilder.
The problem is, somethimes I get a string that is 100,000 lines long (and this is a possible situation for the program), including Rtf codes and colours.
The problem isn’t building the string, it’s when I asign the Rtf property to the StringBuilder.ToString(), it takes a solid 4 minutes to load.
TextBox.Rtf = Build.ToString();
If I copy this same string from the StringBuilder, and load it in WordPad, it takes about 2 or 3 seconds. I am diabling the RTB’s redrawing by using SendMessage() and WM_SETREDRAW, but that doesn’t change anything.
Any suggestions?
RichTextBoxusesriched20.dllwhich is thev3.0of the libraryRich Edit Controlof Microsoft. However, WordPad usesmsfedit.dllwhich is version4.1.Version
4.1is about 30 times more faster thanv3.0See this for more information about versions
MSDN About Rich Edit Controls