c#字幕滚动(winform)/蔡丝军/

老大突然叫我做一个LED屏的项目,没办法,就写了一个简单的例子,然后附到项目中。

要求:实现左右上下都可以自动轮回转动,把所有内容都要显示出来。一个都不能落下。还要可以设置滚动的字幕的大小,字体,颜色等等。

图如:

滚动的控件2011052008325644.jpg

时间控件2011052008341441.jpg

代码如:

时间控件隔时发生事件代码:

左右滚动:

 
  
/// <summary>
/// 时间空间1
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void timer1_Tick_1( object sender, EventArgs e)
{
textBox9.Text
= ClassVar.SystemNowTimeLong();

label1.Left
= label1.Left - 2 ;
if (label1.Left < 0 - label1.Width)
{
label1.Left
= 1050 ;
}

label25.Left
= label25.Left - 2 ;
if (label25.Left > this .Width)
{
label25.Left
= 135 ;
}
 
  
// label25.Right++;

// label24.Left++;
// if (label24.Left > this.Width)
// {
// label24.Left = 300;

// }

// label13.Left++;
// if (label13.Left > this.Width)
// {
// label13.Left = 300;
// }

// label19.Left++;
// if (label19.Left > this.Width)
// {
// label19.Left = 300;
// }

// label8.Left++;
// if (label8.Left > this.Width)
// {
// label8.Left = 300;
// }
// label9.Left++;
// if (label9.Left > this.Width)
// {
// label9.Left = 300;
// }

// label10.Left++;
// if (label10.Left > this.Width)
// {
// label10.Left = 300;
// }

// label11.Left++;
// if (label11.Left > this.Width)
// {
// label11.Left = 300;
// }
// label18.Left++;
// if (label18.Left > this.Width)
// {
// label18.Left = 300;
// }

上下滚动代码:

  /// <summary>
        /// 时间空间2
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer2_Tick(object sender, EventArgs e)
        {
            int top = label23.Top;
            int bt = label23.Bottom;
            top = top - 2;

            if (bt <= this.Top)
            {
                top = 450;
            }
            label23.Top = top;
        }

加载时代码:

        private void Form1_Load(object sender, EventArgs e)
        {

            timer1.Enabled = true;
}

做的粗糙,还有不足的地方还请大家多多指教指教。。。。小弟

 

转载于:https://www.cnblogs.com/caisijun/archive/2011/05/20/CaiSiJun.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值