Hello all. I'm currently writing a code editor that I'm trying to make as close to the VB IDE as possible. One thing it will have is colored keywords, comments, and strings. I already have a function that goes through the text, determines what needs to be colored, and spits out the appropriate RTF code. For my tests, I'm using 5000 lines, each with 4 color words. The line checking goes through all of them and returns one big string containing all 5000 lines with an RTF header and tags in the appropriate places.
Here's were the bottleneck happens. I can't seem to get this RTF text into the box without it taking WAY too long. At first I was using the standard RichTextBox control and inserting via .SelRTF. Later, I ditched that for vbAccelerator's RichEdit control and tried using the EM_STREAMIN method. The gain was minimal at best. The single line that inserts the text takes approximately 19 seconds to execute on my P4 1.7GHz machine. This is unacceptable.
VB's IDE is able to color the same 5000 lines in the blink of an eye... There has to be a faster way. Does anyone know how I can speed this up?