ImageAnimator.Animate Method
Hi, I'm trying to use a (.gif) on my MainForm. I found the class below on MSDN but I don't know how to incorporate into my MainForm. I want to show the (.gif) after the user clicks a button that imports a text file and displays the file in my Datagridview1. After the Datagridview1 updates I want the (.gif) to disapair. Should I use a different class for the (.gif) or should I add it to my MainForm? Below is the class for my image....
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Public Class animateImage
Inherits Form
'Create a Bitmpap Object.
Private animatedImage As New Bitmap("M:\globe.gif")
Private currentlyAnimating As Boolean = False
'This method begins the animation.
Public Sub AnimateImage()
If Not currentlyAnimating Then
'Begin the animation only once.
ImageAnimator.Animate(animatedImage, _
New EventHandler(AddressOf Me.OnFrameChanged))
currentlyAnimating = True
End If
End Sub
Private Sub OnFrameChanged(o As Object, e As EventArgs)
'Force a call to the Paint event handler.
Me.Invalidate()
End Sub
Protected Overrides Sub OnPaint(e As PaintEventArgs)
'Begin the animation.
AnimateImage()
'Get the next frame ready for rendering.
ImageAnimator.UpdateFrames()
'Draw the next frame in the animation.
e.Graphics.DrawImage(Me.animatedImage, New Point(0, 0))
End Sub
Public Shared Sub Main()
Application.Run(New animateImage())
End Sub
End Class

