using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CircleFriendsTools
{
public static class MethodExt
{
///
/// 文本控件方法扩展
///
///
/// 控件内容
/// 显示的颜色
/// 是否换行
public static void AppendTextColorful(this RichTextBox rtBox, string text, Color color, bool addNewLine = true)
{
if (addNewLine)
{
text += Environment.NewLine;
}
rtBox.SelectionStart = rtBox.TextLength;
rtBox.SelectionLength = 0;
rtBox.SelectionColor = color;
rtBox.AppendText(text);
rtBox.SelectionColor = rtBox.ForeColor;
}
}
}