animated gif stop looping

  • Thread starter Thread starter marfi95
  • Start date Start date
M

marfi95

I have an animated gif playing fine in a picture box. However, I don't
want it to keep looping, I only want to play it twice. I found some
code that gets the active frame and loads it looping through, but I
cant get it to work. With this code, it didn't do any animation.

I found this:

For f = 0 To animatedGif.GetFrameCount(frameDimension) - 1
animatedGif.SelectActiveFrame(frameDimension, f)
Dim memoryStream As New System.IO.MemoryStream
animatedGif.Save(memoryStream,
System.Drawing.Imaging.ImageFormat.Bmp)
PictureBox2.Image =
System.Drawing.Image.FromStream(memoryStream)
Application.DoEvents()
Threading.Thread.CurrentThread.Sleep(100)
Next

TIA,
Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top