就是如果字符到最左端后就自动从右端出来,一个跟着一个的,如果有其他办法也行可以不是label控件,只要能定位在界面上的某个指定位置就可以,谢谢

解决方案 »

  1.   

    winform 还是 webform?
    如果是winform,使用timer控件很简单就能解决了,
    如果是webform,使用javascript,window.setInterval(函数,1000)也可以
      

  2.   

    是winform的,怎么使用timer,是一直去改变text的值吧?
    还请指教
      

  3.   

    楼主定义一个全局变量private bool bContinue = true;现大窗体内放入一个label1,一个button,在事件中加入GoAnimate();
    void GoAnimate()
    {
    while (bContinue)
    {
    if (this.label1.Left + this.label1.Width < 0)
    {
    this.label1.Left = this.Width ;
    } this.label1.Left -= 5;
    Application.DoEvents();
    System.Threading.Thread.Sleep(100);
    }
    }
      

  4.   

    楼上这样做是移动label,这样做就不能实现前半部分字符出现在右端而后半部分字符出现在左端。
    继续请教
      

  5.   

    那就自己画了,drawstring,原理大同小异!
      

  6.   

    我有一个办法,就是用Timer和两个Label,两个Label的字符串是一样的,并且最好设成无边框,然后位置是连在一起,然后两个Label一起往一个方向移动(比如左),并且当某个Label移到a点的时候则跳到b点(b点要正好接到此时另一个Label的右边),接着一起向左移.如此反复.这样,字符串就有了一个跟一个的效果.为了出现只有一条字符串的效果,可以拉一些别的控件遮住左边控件的左一半和右边控件的又一半就好了(这些控件不要移动).具体的代码暂时没有时间写,但是楼主只要会用Timer和简单的循环就可以了.不知道这个想法楼主能不能接受.其实我一直就是认为写代码最重要的就是构思,新颖的想法,不知诸位是否认同.
      

  7.   

    bluerush(我本行云) 说的是可以,但是我这边好象不能这么做,因为我是想在一个按扭上实现这个效果的
      

  8.   

    这样符合你的要求吗?
    Label1.Text = "<marquee direction=left behavior=SCROLL scrollamount=2 scrolldelay=10 scrollleft=0 scrolltop=0 id=nbagd height=20 width=100 onMouseOver=nbagd.stop() onMouseOut=nbagd.start()>随便</marquee>";
      

  9.   

    是winform不是webform这个不行,要是行该多好哦!
      

  10.   

    用JS可以实现,你去网上可以搜索下,以前看到过用JS可以实现这种效果,不知道在LABLE上能不能实现
      

  11.   

    没有做过winform的,在webform中很好实现
    但是在winform 中就不知道了
    学习ing!!
      

  12.   


    给你个简单的,帮你搞定:
    首先定义一个数组:
    private System.Windows.Forms.Timer timer1;
    private System.Windows.Forms.Button button1;
    private string [] ab =  new string [6];
    static int num=0;
      

  13.   


    private void Form1_Load(object sender, System.EventArgs e)
    {
    ab[0] = "啊    ";
    ab[1] = "  好啊";
    ab[2] = "你好啊";
    ab[3] = "   你好";
    ab[4] = "     你";
    ab[5] = "       ";
    // Create a new Timer with Interval set to 10 seconds.
    System.Timers.Timer aTimer = new System.Timers.Timer(1000);
    aTimer.Elapsed+=new ElapsedEventHandler(move);
    aTimer.AutoReset = true;
    aTimer.Enabled = true;
    }
    private void move(object source, ElapsedEventArgs e)
    {
    this.button1.Text=ab[num++]; 
    if(num==6)
    {
    num=0;
    }
    }
    其实就是用定时器调用这个move()就可以了。
    这可以达到你要的效果了吧,而且是在button上实现的效果:)!!!
      

  14.   

    To  Toti(as)  在winform的那些控件上可以使用JS脚本实现这个功能?
     有其他知道这个吗?
      

  15.   

    基本上采用 bluerush(我本行云) 的方法,只不过把按扭改成panel,把两个label置在panel上! private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
    {
    this.label1.Left-=10;
    if(this.label1.Left<0)
    this.label2.Left-=10;
    if(this.label1.Left<=-this.label1.Width)
    {
    this.label1.Left=this.label2.Left;
    this.label2.Left=this.panel1.Width;
    }
    }