C#
- 5 ответов
- 0 вопросов
4
Вклад в тег
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
var currentSelStart = richTextBox1.SelectionStart;
var currentSelLength = richTextBox1.SelectionLength;
richTextBox1.SelectAll();
richTextBox1.SelectionColor = SystemColors.WindowText;
var matches = Regex.Matches(richTextBox1.Text, @"\bclass\b");
foreach (var match in matches.Cast<Match>())
{
richTextBox1.Select(match.Index, match.Length);
richTextBox1.SelectionColor = Color.Blue;
}
richTextBox1.Select(currentSelStart, currentSelLength);
richTextBox1.SelectionColor = SystemColors.WindowText;
}