Why does Thread.Sleep() freeze the Form?

前端 未结 6 964
忘掉有多难
忘掉有多难 2021-01-22 03:38

I try to experiment with Thread.Sleep(). I created basic Windows Forms application with one button.

    private void button1_Click(object sender, Ev         


        
6条回答
  •  天命终不由人
    2021-01-22 03:53

    For that you better use a Timer but if you want your current code to work you need to add Application.DoEvents(); after you update the button.Label += "."

提交回复
热议问题