Why RichTextBox lose format after appending new String?
- by user556526
Hi guys
I have aproblem with rich text box string color:
I have the richtexbox that user type a message in it. I mark up each word that exist in my dictionary. I use this code for it:
this.inputTextAreaRtb.Text=this.inputTextAreaRtb.Text.Remove(startCoordinate, endCoordinate - startCoordinate);
this.inputTextAreaRtb.SelectionStart = this.inputTextAreaRtb.Text.Length;
this.inputTextAreaRtb.SelectionLength = 0;
this.inputTextAreaRtb.SelectionFont = new System.Drawing.Font(
"David",
12, FontStyle.Underline);
this.inputTextAreaRtb.SelectionColor = Color.DarkBlue;
this.inputTextAreaRtb.AppendText(_word);
this.inputTextAreaRtb.SelectionColor = this.inputTextAreaRtb.ForeColor;
this.inputTextAreaRtb.SelectionFont = new System.Drawing.Font(
"David",
12, FontStyle.Regular);
But each time if I already marked up a word a loose formatting of words that already formatted.
Any ideas of this problem?