如题..

解决方案 »

  1.   

    对于在窗体上滚动输出文字,可以用TextBox, 设置它的SelectionStart属性,然后调用ScrollToCaret方法。为了持续滚动,你可以使用一个定时器。以下是个例子:public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
                this.timer1.Interval = 1000;
                this.timer1.Tick += new EventHandler(timer1_Tick);
                this.timer1.Start();
            }        void timer1_Tick(object sender, EventArgs e)
            {
                ScrollText();
            }
            int rowindex = 0;
            int rowcount = 0;
                 
            private void Form1_Load(object sender, EventArgs e)
            {
                rowcount = this.textBox1.GetLineFromCharIndex(this.textBox1.TextLength) +1;        }
            private void ScrollText()
            {
                this.textBox1.SelectionStart = this.textBox1.GetFirstCharIndexFromLine(rowindex);
                this.textBox1.ScrollToCaret();
                rowindex++;
                if (rowindex == rowcount)
                {
                    rowindex = 0;
                }
            }    
        }