小编use*_*695的帖子

在循环的任何步骤中更改Label.Text

我想在此代码中的任何步骤标签中显示该步骤的编号.在我的代码中只显示标签中的最后一个数字!

我也Label.Invalidate()完成了,但不起作用.

    private void button1_Click(object sender, EventArgs e)
    {
        int i = 0;
        while (i<100)
        {
            i++;
            label1.Text = string.Format("Step is :{0}", i);
            System.Threading.Thread.Sleep(1000);
        } 
   }
Run Code Online (Sandbox Code Playgroud)

c#

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×1