private void richTextBox1_TextChanged(object sender, EventArgs e) { T.Text = richTextBox1.Text; int i = 0; bool ok = true; string S = T.Text; ST.Rtf = richTextBox1.Rtf; int o = richTextBox1.SelectionStart; int lg = richTextBox1.SelectionLength; ST.SelectionColor = Color.Black; ST.Select(i, richTextBox1.Text.Length - i); ST.SelectionColor = Color.Black; while (i < S.Length) { if (ok) { if (T.GetSpellingErrorStart(i) >= 0) { int l = S.IndexOf(' ', i + 1); if (l < 0) { l = S.Length; } l = l - i; ST.Select(i, l); string st = ST.SelectedText.ToLower(); ST.SelectionColor = Color.Red; ST.SelectionLength = 0; ST.SelectionColor = Color.Black; } else { int l = S.IndexOf(' ', i + 1); if (l < 0) { l = S.Length; } l = l - i; } ok = false; } if (S[i] == ' ') { ok = true; } i++; } richTextBox1.Rtf = ST.Rtf; richTextBox1.SelectionColor = Color.Black; richTextBox1.SelectionStart = o; richTextBox1.SelectionLength = lg; richTextBox1.SelectionColor = Color.Black; ltext = T.Text; }