public static void ShowLog(this SkinChatRichTextBox skrtb, string log) { skrtb.Focus(); skrtb.AppendText(">>> " + log + "\r\n"); skrtb.Select(skrtb.TextLength, skrtb.TextLength); skrtb.ScrollToCaret(); }
public static void ShowLog(this SkinChatRichTextBox skrtb, string log, Color color) { skrtb.Focus(); int textlen = skrtb.TextLength; skrtb.AppendText(">>> " + log + "\r\n"); skrtb.Select(textlen, skrtb.TextLength); skrtb.SelectionColor = color; skrtb.Select(skrtb.TextLength, skrtb.TextLength); skrtb.ScrollToCaret(); }
private void WriteRichTextLog(SkinChatRichTextBox richTextControl, LogInfo log) { this.Invoke(new ThreadStart(delegate { if (richTextControl.Lines.Count() > 500) { richTextControl.ResetText(); } switch (log.Level) { case "Error": richTextControl.AppendRichText(log.ToString(), new Font("微软雅黑", 9f), Color.Crimson); break; default: richTextControl.AppendRichText(log.ToString(), new Font("微软雅黑", 9f), Color.FromArgb(2, 79, 142)); break; } richTextControl.AppendText(Environment.NewLine); //滚动到光标位置 richTextControl.ScrollToCaret(); })); }