Imports System Imports System.Drawing Imports System.Windows.Forms PublicClass Form1ClassClass Form1Class Form1 '创建图片对象 Private animatedImage AsNew Bitmap ("C:ani.gif") Private currentlyAnimating AsBoolean=False '启动动画 PublicSub AnimateImage()Sub AnimateImage()Sub AnimateImage()Sub AnimateImage() IfNot currentlyAnimating Then 'Begin the animation only once. ImageAnimator.Animate(animatedImage, _ New EventHandler(AddressOfMe.OnFrameChanged)) currentlyAnimating =True EndIf End Sub Sub OnFrameChanged()Sub OnFrameChanged(ByVal o AsObject, ByVal e As EventArgs) '强制刷新 Me.Invalidate() End Sub PrivateSub Form1_Paint()Sub Form1_Paint(ByVal sender AsObject, ByVal e As System.Windows.Forms.PaintEventArgs) HandlesMe.Paint AnimateImage() '准备下一帧用以呈现 ImageAnimator.UpdateFrames() '画下一帧 'e.Graphics.DrawImage(Me.animatedImage, New Point(0, 0))'以原始图象大小画 e.Graphics.DrawImage(Me.animatedImage, Me.ClientRectangle)’以当前窗体客互区大小画 End Sub End Class