RichTextBox question

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,
 
S

Stoitcho Goutsev \(100\)

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");
 
G

Gabriel

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,
 
G

Gabriel

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

oops

richTextBox1.SelectionColor :)



than ks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top