When i search for certain words in RichTextBox i want to highlight them(if there is a match).That's ok but the problem is that i don't know how to set their default color back.I mean like the searching function in Firefox,all founded words are colored in yellow,then user can remove the highlighting.How to achieve that?I really can't see another way of doing that instead of saving the position and length of founded words and set their default color after that.But here is another problem,the default color of the words is not always the same for all words and this complicate the situation.Can anyone help me with that?I use this method to find the words and to highlight them.

if (searchForTextTextBox.Text == "")
                MessageBox.Show("Type text in text box.", "Error");
                    RichTextBoxFinds rtbFinds = new RichTextBoxFinds();

                    if (checkBox1.Checked == true)
                        rtbFinds = RichTextBoxFinds.MatchCase;
                    else if (checkBox2.Checked == true)
                        rtbFinds = RichTextBoxFinds.WholeWord;
                    string searchString = searchForTextTextBox.Text;
                    found = newChannel.messageRTB.Find(searchString, start, rtbFinds);
                    start = newChannel.messageRTB.SelectionStart + newChannel.messageRTB.SelectionLength;
                    newChannel.messageRTB.SelectionColor = Properties.Settings.Default.findedTextColor;
                    oneFound = true;
                } while (found != -1);

                if (found == -1 && !oneFound)
                    MessageBox.Show("The text was not found.");
                    found = -1;
                else if (found == -1 && oneFound) { }
This article has been dead for over six months. Start a new discussion instead.