private static void ScrollToEnd() { if (frm == null) frm = new frmResult(); if (thisFrm.textBox1.Text.Length > 0) thisFrm.textBox1.Select(thisFrm.textBox1.Text.Length, 0); thisFrm.textBox1.ScrollToCaret(); }
public static void ShowLog() { if (frm == null) frm = new frmResult(); int x = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width - frm.Width; int y = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height - frm.Height; frm.SetDesktopLocation(x, y); CallShow(); ScrollToEnd(); frm.TopMost = true; frm.Activate(); }
public static void UpdateLog(string txt) { if (frm == null) frm = new frmResult(); // InvokeRequired需要比较调用线程ID和创建线程ID // 如果它们不相同则返回true if (thisFrm.textBox1.InvokeRequired) { SetTextCallback d = new SetTextCallback(UpdateLog); frm.Invoke(d, new object[] { txt }); } else { thisFrm.textBox1.Text += txt; ScrollToEnd(); } }