Use a timer.
First declare your timer and check it every second, calling TimerEventProcessor when it is ticking.
static System.Windows.Forms.Timer myTimer = new System.Windows.Forms.Timer(); myTimer.Tick += new EventHandler(TimerEventProcessor); myTimer.Interval = 1000; myTimer.Start();
Your class will need an image1 array and an int imageCounter variable to keep track of the current image available to the TimerEventProcessor function.
var image1[] = ...; var imageCounter = 0;
Then write what you want to do on each tick
private static void TimerEventProcessor(Object myObject, EventArgs myEventArgs) { if (image1 == null || imageCounter >= image1.Length) return; pictureBox1.Image = Image.FromFile(image1[imageCounter++]); }
Something like this should work.
source share