private void timer1_Tick(object sender, System.EventArgs e)
{
if(index >= count)
{
timer1.Enabled = false;
index = count = 0;
return;
}
index+=2;
richTextBox1.Select(index,0);
richTextBox1.ScrollToCaret();
} private void richTextBox1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
index = 0;
count = richTextBox1.Text.Length;
timer1.Enabled ^= true;
}
这是个richTextbox滚动的代码,不知道是不是符合你的要求!
下面这段是Label滚动的代码private void Form1_Load(object sender, System.EventArgs e)
{
this.timer1.Start(); }
private void timer1_Tick(object sender, System.EventArgs e)
{
this.timer1.Interval=1000;
if (this.label1.Location.Y<0)
{
this.label1.Location=new System.Drawing.Point(this.label1.Location.X,this.Height);
}
else
{
this.label1.Location=new System.Drawing.Point(this.label1.Location.X,this.label1.Location.Y-this.label1.Height-5);
} }

解决方案 »

  1.   

    如果用richtextbox显示来自数据库的内容好象不能象datagrid那样对齐.
      

  2.   

    在文本之前插入空格啊
                                        dskfljslflksdf
                                slfldskfljskfjlsfjlksfjlsfjklsfjl
                                     dsfsfsfsdfsdfsdfsffs
                              sdfsdfsdfsfsfsdfsfsfsfsdfsfgfdgsbdfgfg
                                            dsfsf
      

  3.   

    上面是CSDN的问题,你复制到记事本看是对齐的.
    或者用Align属性