C# Winforms: A thread that can control the UI and can “sleep” without pausing the whole program. How?

前端 未结 4 1872
-上瘾入骨i
-上瘾入骨i 2021-01-14 05:31

OK...

Looks like WinForms and Threading in the same program is something that I can\'t master easily.

I\'m trying to make a custom Numeric Up Down out of two

4条回答
  •  情深已故
    2021-01-14 06:07

    button.Click += delegate { BeginInvoke(new UiUpdate(delegate { Thread.Sleep(500); // Do Stuff After Sleep };)) };
    
    private delegate void UiUpdate();
    

提交回复
热议问题