Exemple #1
0
        void Tracer_NewTrace(object sender, NewTraceEventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new EventHandler <NewTraceEventArgs>(Tracer_NewTrace), sender, e);
                return;
            }

            //Check if the textbox is scrolled to the bottom
            bool lastLineVisible = textBoxTrace.SelectionStart > textBoxTrace.Text.Length - 100;

            this.textBoxTrace.Text += e.Trace;
            if (textBoxTrace.Text.Length > 10000)
            {
                textBoxTrace.Text = textBoxTrace.Text.Substring(textBoxTrace.Text.Length - 5000);
            }

            if (lastLineVisible)
            {
                textBoxTrace.SelectionStart = textBoxTrace.Text.Length;
                textBoxTrace.ScrollToCaret();
            }
        }
Exemple #2
0
        void Tracer_NewTrace(object sender, NewTraceEventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new EventHandler<NewTraceEventArgs>(Tracer_NewTrace), sender, e);
                return;
            }

            //Check if the textbox is scrolled to the bottom
            bool lastLineVisible = textBoxTrace.SelectionStart > textBoxTrace.Text.Length - 100;

            this.textBoxTrace.Text += e.Trace;
            if (textBoxTrace.Text.Length > 10000)
            {
                textBoxTrace.Text = textBoxTrace.Text.Substring(textBoxTrace.Text.Length - 5000);
            }

            if (lastLineVisible)
            {
                textBoxTrace.SelectionStart = textBoxTrace.Text.Length;
                textBoxTrace.ScrollToCaret();
            }
        }