Exemple #1
0
        private static void ScrollToEnd()
        {
            if (frm == null) frm = new FormResult();

            if (frm.textBox1.Text.Length > 0)
                frm.textBox1.Select(frm.textBox1.Text.Length, 0);
            frm.textBox1.ScrollToCaret();
        }
Exemple #2
0
        public static void ShowLog()
        {
            if (frm == null) frm = new FormResult();

            if (!TimeStampIsLangEnough("显示记录")) return;

            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);
            frm.Show();
            ScrollToEnd();
            frm.TopMost = true;
            frm.Activate();
        }
Exemple #3
0
        public static void UpdateLog(string txt)
        {
            if (frm == null) frm = new FormResult();

            // InvokeRequired需要比较调用线程ID和创建线程ID
            // 如果它们不相同则返回true
            if (frm.textBox1.InvokeRequired)
            {
                SetTextCallback d = new SetTextCallback(UpdateLog);
                frm.Invoke(d, new object[] { txt });
            }
            else
            {
                frm.textBox1.Text += txt;
                ScrollToEnd();
            }
        }