/// <summary>
/// 显示日志
/// </summary>
/// <param name="msg">信息</param>
/// <param name="color">显示颜色</param>
private void ShowMsg(string msg, Color color)
{
if (string.IsNullOrEmpty(msg))
return;
if (txtLog.IsHandleCreated)
{
txtLog.BeginInvoke(new Action(() =>
{
txtLog.SelectionColor = color; // 设置输入字体颜色
txtLog.AppendText(DateTime.Now.ToString("[mm:ss] ") + msg + Environment.NewLine);
txtLog.Focus(); // 获取焦点
txtLog.Select(txtLog.TextLength, 0); // 光标定位到文本最后
txtLog.ScrollToCaret(); // 滚动到光标处
DoOutMessage(msg, 9);
}));
}
}