0

Hello guys. I've found a new problem. I'm using an string array ( unidimensional: Important[] ), and a RichtextBox Text.

Let's say, my rich text box is: 1 january 1852 - In this year, Eugene-Antole Demarcay was born.

Ok, i want like Eugene-Antole Demarcay to have it's color red, and I did:

for (int i = 0; i < Important.Length; i++)
            {
                richTextBox1.Find(Important[i], RichTextBoxFinds.MatchCase);
                richTextBox1.SelectionColor = Color.Red;
            }
      richTextBox1.SelectionStart = 0;

Ok, and my text looks now: 1 january 1852 - In this year, Eugene-Antole Demarcay was born., but i have a new problem, look at photo: http://img191.imageshack.us/img191/2704/phototb.png

That blue background color, i don't want it ...

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by nick.crane
0

no lol, try to select my text and you'll see how the background color it's changing ....

0

Assuming that it is the Dark Blue that you do not want then it is because you are not resetting the SelectionLength property to zero when you reset the SelectionStart.
SelectionLength is still set to the length of the newly Red text and therefore the selection highlight is shown on the first 22 characters.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.