我有一个WinForms程序,在这个statusStrip
中有一个button
、一个statusStrip
和一个toolStripStatusLabel
。如果我单击该按钮并运行:
private void button1_Click(object sender, EventArgs e)
{
toolStripStatusLabel1.Text = "Test";
System.Threading.Thread.Sleep(5000);
}
那么toolStripStatusLabel
的文本直到线程休眠之后才会更新。我如何让它立即更新,然后休眠线程呢?
发布于 2017-04-18 14:08:04
正如P. Kouvarakis所说,解决方案是:
toolStripStatusLabel1.Text = "Test";
statusStrip1.Update();
发布于 2021-02-16 17:06:27
当状态条将Spring设置为true时,我的状态标签更改没有在运行时显示。我把春天设为假的,它就开始显现了。
发布于 2021-04-08 11:55:25
不要在这里添加文本更改代码,因为只有在单击它之后才会刷新它(如您在图片-statusStrip1_ItemClicked上看到的那样),因此,任何statusStrip1.Update();this.Update();等等都无法帮助您。
if
,如下图所示
https://stackoverflow.com/questions/43460212
复制相似问题