Here's a very simple method that uses the WebBrowser control to display an Animated GIF with no hassle.
Add a Picturebox, WebBrowser, Command Button and CommonDialog Control to a Form:
VB Code:
Option Explicit
Private Sub Command1_Click()
On Error GoTo Cancel_Error
With CommonDialog1
.Filter = "GIFs|*.gif"
.ShowOpen
Call OpenGif(.FileName)
End With
Cancel_Error:
End Sub
Private Sub OpenGif(ByVal sFile As String)
' Place the WebBrowser control within a Picturebox
' So we cancover the Scrollbars
Set WebBrowser1.Container = Picture1
' Set the Picturebox ScaleMode to Pixels
Picture1.ScaleMode = vbPixels
' Make the Picturebox Resize to Fit a picture loaded into it.
Picture1.AutoSize = True
' Load a Static image of the GIF into the Picturebox, just
' to get it's dimensions.
Picture1 = LoadPicture(sFile)
' Reposition the Webbrowser control within the Picturebox
' So that only the GIF will be visible witin the Picturebox area.
WebBrowser1.Move -12, -17, Picture1.ScaleWidth + 50, Picture1.ScaleHeight + 50
' Load the GIF into the WebBrowser Control which supports Animated GIFs.
WebBrowser1.Navigate2 sFile
End Sub