Label中文字左右滚动
这个是自己拼起来来的,也不知道怎么简单,就写成这样了,不过可以实现在label中左右滚动
在这之前要定义一个用来控制滚动的线程(可以改一下方法为传入参数,参数是文字滚动的label)
public void Roll()
{
string a = "左边";
do
{
if (a == "左边")
{
do
{
roll++;
this.lblrollfont.Location = new System.Drawing.Point(roll, 10);
if (this.lblrollfont.Location.X + 1 == 349)
//349是lable的x座标(就是移到要换方向滚动向右边时的X座标)
{
a = "右边";
break;
}
Thread.Sleep(10);
} while (a == "左边");
}
if (a == "右边")
{
do
{
roll--;
this.lblrollfont.Location = new System.Drawing.Point(roll, 10);
if (this.lblrollfont.Location.X + 1 == 0)
{
a = "左边";
break;
}
Thread.Sleep(10);
} while (1 == 1);
}
} while (1 == 1);
}
转自:http://blog.csdn.net/watershuimiao/article/details/5722540