做了个程序,label里的文字太多,我想他里面的文字滚动起来,我知道用timer,但是具体怎么实现谁能帮帮我

解决方案 »

  1.   

    在timer里面写:labe1l.Text = new string(label1.Text.Skip(1).ToArray()) + labe1l.Text[0].ToString();
      

  2.   

    滚动改变的不是Text属性
    滚动改变的是top,或left位置属性.
      

  3.   


    出现报错提示“string”并不包含“Skip”的定义
      

  4.   

    那岂不是label的位置发生了变化  
    我想做的是他在一个画面内滚动  或者翻页也可以
      

  5.   

    用timer 在里边进行判断
    label.left-=20;
    if(label.right<0)
    label.left=width
      

  6.   

    你可以用一个panel容器
    label在里面移动如果你要改变Text属性
    还你得用个公共变量先把你的内容存储下来
    然后循环substring
      

  7.   

    楼主是因为文字太多而烦恼,这个好解决,用drawstring简单方便,我做过这样的这个代码你拿去改下就可以用
                int  x = (--x) % (label2.Width + 80);
                Graphics gr = this.label2.CreateGraphics();
                gr.FillRectangle(new SolidBrush(System.Drawing.SystemColors.Control),new Rectangle(0,0,327,16));
                gr.DrawString(a,label2.Font,Brushes.Red,new PointF(x + 50,0));
                gr.DrawString(a,label2.Font, Brushes.Red, new PointF(454 + x,0));
    里面的数字是控件label的长度和字符串的长度
      

  8.   

    楼主是因为文字太多而烦恼,这个好解决,用drawstring简单方便,我做过这样的这个代码你拿去改下就可以用
                int  x = (--x) % (label2.Width + 80);
                Graphics gr = this.label2.CreateGraphics();
                gr.FillRectangle(new SolidBrush(System.Drawing.SystemColors.Control),new Rectangle(0,0,327,16));
                gr.DrawString(a,label2.Font,Brushes.Red,new PointF(x + 50,0));
                gr.DrawString(a,label2.Font, Brushes.Red, new PointF(454 + x,0));
    里面的数字是控件label的长度和字符串的长度
      

  9.   

    Label在页面上显示后就是一个DIV,写个脚本,在加载页面的时候调用一个方法,用settimeout不停滚动内容即可实现
      

  10.   

       //控制lable的速度
            private void timer3_Tick(object sender, EventArgs e)
            {
                label1.Left -= 2;
                if (label1.Right < 0)
                {
                    label1.Left = this.Width;
                }
            }