Wondering how you are walking through the text? If you are using rtb
functions like find then I would like to suggest you try using instr() You
can search for the text, get the start and end positions and then simply set
the color on the selection. As an example:
SelectionStart = nStartPos
SelectionLength = nEndPos - nStartEnd + 1
SelectionColor = Color.Purple
I developed a Richtextbox control that color codes HTML much the same as
frontpage and other applications. I get no flicker using this method...it's
much much faster
I do it using Instr, so I get the speed advantage you mention.
The flicker that I have comes from setting .SelectionStart and
..SelectionLength in an rtb such that windows decides to scroll the new
selection into view. The best I was able to achieve without my
sendtoback-bringtofront gimmick was setting rtb's Enabled to false during
highlighting, then back to true when done. This got rid of scrolling
flicker, but it did yield a visual artifact that looked like graying out a
control followed by painting. All visual problems went away with the
back-front gimmick.
I haven't tried Herfried's suggestion since I prefer not using win32 apis
whenever possible. I have tried api LockWindowUpdate, and I had a snowy
flicker-like effect.
Do you have any visual problems in your html highlighter when the text is
large relative to the window size? I'm curious about how you do things in
this area. Much has been written about the topic of flicker or other
undesirable visual effects, and after much trial and error, I settled on the
back-front gimmick. Maybe you have a better way.