0

is it possible to define forecolors for multiple lines in a RichTextBox?

I am only able to do something like this:

tb.ForeColor = Color.Red;

-> The text of all lines will be red.

What i want to do is to set a different color for every line. For example: line1: blue, line2: green, line3: yellow

Following problem:

foreach (var line in tb.Lines)
{

}

While defining tb.Lines == 0, so i can´t define colors for the single lines...

suggi87
  • 59
  • 1
  • 6

1 Answers1

0

you can use the inlines definition in RichTextBox in order to define how the text has to be formatted

see this link to a stackoverflow old question for how to do it in a RichTextBox

Community
  • 1
  • 1
cristallo
  • 1,951
  • 2
  • 25
  • 42