VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



VB.NET - Animate GIF File Without Using Any Controls - Simple Code.

by Gehan Fernando. (13 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB.NET
Difficulty: Unknown Difficulty
Originally Published: Wed 15th November 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)

VB.NET - Animate GIF File Without Using Any Controls - Simple Code.

Rate VB.NET - Animate GIF File Without Using Any Controls - Simple Code.




    Private animatedImage As New Bitmap("c:\gif4.gif")
    Private currentlyAnimating As Boolean = False

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        AnimateImage()

    End Sub

    Private Sub AnimateImage()
        If Not currentlyAnimating Then
            ImageAnimator.Animate(animatedImage, _
            New EventHandler(AddressOf Me.OnFrameChanged))
            currentlyAnimating = True
        End If
    End Sub

    Private Sub OnFrameChanged(ByVal Sender As Object, ByVal e As EventArgs)
        Me.Invalidate()
    End Sub

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint

        AnimateImage()
        ImageAnimator.UpdateFrames()
        e.Graphics.DrawImage(Me.animatedImage, New Point(50, 100))

    End Sub

End Class

Download this snippet    Add to My Saved Code

VB.NET - Animate GIF File Without Using Any Controls - Simple Code. Comments

No comments have been posted about VB.NET - Animate GIF File Without Using Any Controls - Simple Code.. Why not be the first to post a comment about VB.NET - Animate GIF File Without Using Any Controls - Simple Code..

Post your comment

Subject:
Message:
0/1000 characters