Toggling Picture Box visibility C#

前端 未结 4 1357
失恋的感觉
失恋的感觉 2021-01-27 06:56

Why is the picture box control\'s visibility property not working here. I have initially set them to false, so that when the screen loads they are not visible. But then I wish t

4条回答
  •  抹茶落季
    2021-01-27 07:42

    In addition to Thread.Sleep(); call Application.DoEvents() to trigger event handling/ui updating. However ensure you're not calling Action() again somehow. A simple Thread.Sleep() won't allow the UI to update as you're still in the handler and the framework won't be able fire any new events on its own as it won't know if you're finished when waiting (due to the thread still being busy).

    Overall your approach might be a bad idea (depending on other code etc.). Consider using timers or a background worker instead.

提交回复
热议问题