RichTextBox question

  • Thread starter Thread starter Gabriel
  • Start date Start date
G

Gabriel

Hello,

Is it possible to insert line by line a string to a RichTextBox ? and give a
font color different for each line ? I'd like a control like a TMemo in the
Delphi.

Thanks,
 
Gabriel,

Here is some example how to do that:

this.richTextBox1.SelectionFont = new Font(this.Font, FontStyle.Bold);
this.richTextBox1.AppendText("Line1\n");
this.richTextBox1.SelectionFont = new Font(this.Font, FontStyle.Italic);
this.richTextBox1.AppendText("Line2");
 
this.richTextBox1.SelectionFont = new Font(this.Font, FontStyle.Bold);
this.richTextBox1.AppendText("Line1\n");
this.richTextBox1.SelectionFont = new Font(this.Font, FontStyle.Italic);
this.richTextBox1.AppendText("Line2");

And to change the font color, not the richtextbox's background ?

Thanks,
 
And to change the font color, not the richtextbox's background ?

oops

richTextBox1.SelectionColor :)



than ks,
 
Back
Top