Toggling Picture Box visibility C#

前端 未结 4 1358
失恋的感觉
失恋的感觉 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:29

    Setting the Visible property to true doesn't show the control, it only creates a message that will show it. As long as you are keeping the main thread busy with a Sleep, it will not process any messages, and the controls won't be shown.

    You should show the picture boxes and then set up a timer with code that will hide the picture boxes when the timer's tick event is triggered. Then you exit your method so that the main thread can handle the messages that will show the picture boxes.

提交回复
热议问题