Change image in picturebox every second C#

后端 未结 5 1580
一整个雨季
一整个雨季 2021-01-13 13:08

I\'m creating a WinForm application that takes a person\'s photo with a webcam and am trying to now create a countdown effect. I have 4 images that i would like to cycle thr

5条回答
  •  忘掉有多难
    2021-01-13 13:24

    The problem is that you are spinning in a busy loop while the timer is running. You should check the timer stop condition in the event handler.

    I am also a bit surprised that the code works. If you are using System.Windows.Forms.Timer, you should not even get into the event handler and so the counter should not be incremented. Also the counter value is not properly checked nor updated. The while loop can be transformed into endless loop.

提交回复
热议问题