首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

控件滚动有关问题

2011-12-19 
控件滚动问题求C#的滚动代码,以标签为例,主要是怎样让标签滚到左边时回到窗体的右边[解决办法]试试这样:pr

控件滚动问题
求C#的滚动代码,以标签为例,主要是怎样让标签滚到左边时回到窗体的右边

[解决办法]
试试这样:

private void button1_Click(object sender, EventArgs e)
{
Timer timer = new Timer();
timer.Interval = 30;
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
}

void timer_Tick(object sender, EventArgs e)
{
if (this.label1.Right <= this.ClientRectangle.X)
{
this.label1.Left = this.ClientRectangle.Right;
}
else
{
this.label1.Left--;
}
}

热点排行