how can we stop any animated picture on form load event in windows form application. Actually, i want to start animated motion on button click and after 5 sec it should stop autometically .
i tried with this code but didn't work.
System.Drawing.ImageAnimator.Animate(pictureBox1.Image, OnFrameChanged);
System.Threading.Thread.Sleep(5000);
System.Drawing.ImageAnimator.StopAnimate(pictureBox1.Image, OnFrameChanged);
and on form load :
System.Drawing.ImageAnimator.Animate(pictureBox1.Image, OnFrameChanged);