K
kelvin.koogan
I am trying to do an operation where I find and highlight all
instances of a string in a RichTextBox. E.g.
pMatchesFound = Regex::Matches(pRichTextBox->Text, pStr, options);
for (int i = 0; i < pMatchesFound->Count; i++)
{
Match ^m = pMatchesFound;
pRichTextBox->SelectionStart = m->Index;
pRichTextBox->SelectionLength = m->Length;
pRichTextBox->SelectionColor = SystemPens::HighlightText->Color;
pRichTextBox->SelectionBackColor = SystemPens::Highlight->Color;
}
However the user sees the text scrolling through the RichTextBox as
all the strings are highlighted, which isn't what I want. I've tried
to prevent this with SuspendLayout but it doesn't work.
Is there a way to stop the RichTextBox updating while I'm highlighting
all the strings?
TIA,
KK
instances of a string in a RichTextBox. E.g.
pMatchesFound = Regex::Matches(pRichTextBox->Text, pStr, options);
for (int i = 0; i < pMatchesFound->Count; i++)
{
Match ^m = pMatchesFound;
pRichTextBox->SelectionStart = m->Index;
pRichTextBox->SelectionLength = m->Length;
pRichTextBox->SelectionColor = SystemPens::HighlightText->Color;
pRichTextBox->SelectionBackColor = SystemPens::Highlight->Color;
}
However the user sees the text scrolling through the RichTextBox as
all the strings are highlighted, which isn't what I want. I've tried
to prevent this with SuspendLayout but it doesn't work.
Is there a way to stop the RichTextBox updating while I'm highlighting
all the strings?
TIA,
KK