private void button26_Click(object sender, EventArgs e)
{
Task t = Task.Run(() => {
Test();
});
}
private void Test()
{
倒计时(richTextBox1, 5);
//richTextBox1.Text = richTextBox1.Text + ";"+"GO!!!!!!";//不会更新
richTextBox1.BeginInvoke(new Action(() => { richTextBox1.Text = richTextBox1.Text + ";GO!!!!!!" ; }));
倒计时(richTextBox1, 10);
}
private void 倒计时(RichTextBox richTextBox, int Seconds)
{
for (int i = Seconds; i >= 0; i--)
{
richTextBox.BeginInvoke(new Action(() => { richTextBox.Text = richTextBox.Text+";"+i.ToString(); }));
Thread.Sleep(1000);
}
}
C# 倒计时不卡画面
最新推荐文章于 2024-07-29 19:45:53 发布