c# - Multiple text format in a RichTextBox -


suppose there 2 lines. red line. blue line. can with.

you use:

void appendtext(richtextbox box, color color, string text) {     int start = box.textlength;     box.appendtext(text);     int end = box.textlength;      // textbox may transform chars, (end-start) != text.length     box.select(start, end - start + 1);     box.selectioncolor = color;     // set box.selectionbackcolor, box.selectionfont, etc...     box.selectionlength = 0; // clear } 

and then

appendtext(rtb, color.red, "line1"); appendtext(rtb, color.blue, "line2"); 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -