我正在使用一个标签,其中从文本框输入的文本显示在该标签中。现在,我想让标签文本滚动。我通过互联网环顾四周,并尝试将其写入标签内的代码:
private void label1_Click(object sender, EventArgs e)
{
int Scroll;
string strString = "This is scrollable text...This is scrollable text...This is scrollable text";
Scroll = Scroll + 1;
int iLmt = strString.Length - Scroll;
if (iLmt < 20)
{
Scroll = 0;
}
string str = strString.Substring(Scroll, 20);
label1.Text = str;
}
有人看到我做错了什么吗?
最佳答案
//更简单:
private void timer2scroll_Tick(object sender, EventArgs e)
{
label10Info.Text = label10Info.Text.Substring(1, label10Info.Text.Length - 1) + label10Info.Text.Substring(0,1);
}
关于c# - 标签滚动效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13740183/