Different Colour lines in RichTextBox Control

  • Thread starter Thread starter Nick Bunton
  • Start date Start date
N

Nick Bunton

In a windows forms application I want the text in a
RichTextBox control to have different font colour
depending on its source. So for example the first three
lines may be Black, Red and Blue respectively. Is this
possible and if so can anyone point me in the direction
of an article or sample?

Thanks

Nick
 
The following link gives you the RTF codes supported by the RichTextBox
control

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rtfbox98/ht
ml/vbconsupportedrtfcodes.asp

You can create an entire text string including the RTF codes and put it in
the TextRTF property.

--
Bob Powell [MVP]
C#, System.Drawing

September's edition of Well Formed is now available.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm
 
Hello,

Nick Bunton said:
In a windows forms application I want the text in a
RichTextBox control to have different font colour
depending on its source. So for example the first three
lines may be Black, Red and Blue respectively. Is this
possible and if so can anyone point me in the direction
of an article or sample?

Have a look at the RichTextBox's 'SelectionColor' property.
 
Back
Top