private void ColorThisWord(string p, ref RichTextBox r) { r.Find(p); return; string f = r.Text; r.Text = ""; Color s = r.SelectionColor; foreach (string w in f.Split(new char [] { ' ' })) { r.SelectionColor = s; if (w.ToLower() == p.ToLower()) { int length = r.TextLength; // at end of text r.AppendText(w + " "); r.SelectionStart = length; r.SelectionLength = p.Length; r.SelectionColor = Color.Black; } else { int length = r.TextLength; // at end of text r.AppendText(w + " "); r.SelectionStart = length; r.SelectionLength = p.Length; r.SelectionColor = Color.Red; } } return; int length2 = RTXBXResponse.TextLength; // at end of text RTXBXResponse.AppendText(p); RTXBXResponse.SelectionStart = length2; RTXBXResponse.SelectionLength = p.Length; RTXBXResponse.SelectionColor = Color.Red; }
private void txbxSearchResponse_TextChanged(object sender, EventArgs e) { RTXBXResponse.HighlightNo(Color.Black); RTXBXResponse.HighlightText(this.txbxSearchResponse.Text, Color.Red); }