bsp; control.Text = num.ToString();
Thread.Sleep(100);
} while (true);
}
#endregion
方法二,使用委托异步调用#region 方法二,使用委托异步调用
public void BuildNum2()
{
Random myRand = new Random(num2);
while (true)
{
SetText(myRand.Next(0, 10).ToString());
Thread.Sleep(100);
}
}
#endregion
改变UI 线程的控件属性#region 改变UI 线程的控件属性
public void SetText(string str)
{
if (control.InvokeRequired)
{
SetLabelText setLableText = new SetLabelText(SetText);
control.Invoke(setLableText, new object { str}); [Page]
}
else
{
control.Text = str;
}
}
#endregion
public void Kill()
{