我有一个我在代码上绘制的gif图像,然后使用此代码为图像设置动画:
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Public Class animatingimage
Inherits Form
'Create a Bitmpap Object.
Private animatedImage As New Bitmap("E:\Data laptop\atom project\atom project etc\gambar2\Sprites fix\run\M\M_run_fixed\L\larikanan.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(ByVal o As Object, ByVal e As EventArgs)
'Force a call to the Paint event handler.
Me.Invalidate()
End Sub
Protected Overrides Sub OnPaint(ByVal 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(300, 300))
End Sub
Public Shared Sub Main()
Application.Run(New animatingimage)
End Sub
现在,如何将图像可见性视为错误?我的意思是,隐藏那个图像。