我在表单上有一个标签,我想每 3 秒使用 string[] 数组中的值更改标签。我想无休止地旋转字符串数组来更新标签。
public void rotateMarqueText(string text)
{
string[] result = text.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
newsPostCount = result.Count();
new Task(() =>
{
foreach (var a in result)
{
DisplayText(a);
Thread.Sleep(3000);
return true;
}
}
).Start();
}
private System.Windows.Forms.Timer timer;
private void DisplayText(string x)
{
marqueText.Text = x;
}
它不会在列表中旋转