Deselect text in richtextBox without losing highlighted text c# -


c# language, visual studio 2010 express

is possible deselect text richtextbox without losing actual highlighted text?

if highlight selected text lose old one, if select end of text lose have highlighted.

thanks lot!!!

here partial code:

(i call code if test passed , want highlight string makes 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 keep serial's data readable user, use function scroll text of richtextbox till end of text:

            tb_log.selectionstart = tb_log.text.length;             tb_log.selectionlength = 0;             tb_log.scrolltocaret(); 

after command old selected text, highlighted in green, disappears.

my goal, again, keep background color of text highlighted before , highlight again , again in future.

the code posted not make lime highlighted text "unhighlight".

i suspect have:

tb_log.text += text; 

somewhere in code. replace of current formatting. use

tb_log.appendtext(some text); 

instead preserve richness of format.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -