C# language, visual studio 2010 express
Is it possible to deselect text from a richtextBox without losing the actual highlighted text?
If I highlight another selected text I lose the old one, if I select the end of the text I lose everything I have highlighted.
Thanks a lot!!!
Here is the partial code:
(I call this code if a test is passed and I want to highlight the string that makes my test passed)
int index = tb_log.Text.IndexOf(s.stringParse);
tb_log.Select(index, s.stringParse.Length);
tb_log.SelectionBackColor = Color.Lime;
tb_log.SelectionColor = Color.Black;
tb_log.SelectionFont = new Font(tb_log.Font, FontStyle.Bold);
Then to keep the serial's data readable by the user, i use this function to scroll the text of richtextbox till the end of the text:
tb_log.SelectionStart = tb_log.Text.Length;
tb_log.SelectionLength = 0;
tb_log.ScrollToCaret();
After this command the old selected text, that I highlighted in green, disappears.
My goal, again, is to keep the background color of the text that i highlighted before and highlight again and again in the future.