Re: RichTextBox.Select = SLOOOOOOOOW ?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thank you, I'll try that out!



GavCost wrote:
> Hi Jim
>
> I had problems like this a few years back. Unfortunately it was in a
> different job so I can't get the code but from what I can remember it had
> something to do with the SelectionChanged event being raised. As we were
> using an inherited RichTextBox we were able to use a flag in the
> OnSelectionChanged method to prevent the base implementation from being
> called.
>
> protected override OnSelectionChanged(System.EventArgs e)
> {
> if (_coloring)
> {
> // Skip.
> }
> else
> {
> base.OnSelectionChanged(e);
> }
> }
>
> Hope this helps but my memory is a bit fuzzy, there was probably more to it.
>
> Gav
>
>
> "jim" wrote:
>
> >
> >
> > I'm iterating through several hundred words/lines of text.
> >
> > I select a particular word or line with the RichTextBox.Select method
> > and then change the color.
> >
> > For some reason, RichTextBox.Select is extremely slow to return (using
> > C#).
> >
> > myRichTextBox.Select(pos, len); <------SLOOOOOOOOW
> > myRichTextBox.SelectionColor = c;
> >
> >
> > Any suggestions?
> >
> >
> > Please help...?
> >
> >

.