RichTextBox 改变每行的字体颜色
1、新建方法AppendTextColorful(this RichTextBox rtBox, string text, Color color, bool addNewLine)
2、调用方法AppendTextColorful(this RichTextBox rtBox, string text, Color color, bool addNewLine)
public static class ExtensionClass{public static void AppendTextColorful(this RichTextBox rtBox, string text, Color color, bool addNewLine){if (addNewLine){text += Environment.NewLine;}rtBox.SelectionStart = rtBox.TextLength;rtBox.SelectionLength = 0;rtBox.SelectionColor = color;rtBox.AppendText(text);rtBox.SelectionColor = rtBox.ForeColor;}}