Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there any method I can use in order to know when animation1 has fin

Status
Not open for further replies.

piscis

Programmer
Jun 26, 2003
29
PR
Is there any method I can use in order to know when animation1 has finished its very first loop?

I need to start animation2 only when I’m sure that animation1 has finished, (animation1 has 14 frames) can anyone provide me with a suggestion?

Thanks Andy

This is the code I have so far:
Code:
Private TankFillingLow As Bitmap
    Private TankFillingLowPosition As Point

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        TankFillingLow = New Bitmap("TankFillingLow.gif")
        ImageAnimator.Animate(TankFillingLow, New EventHandler(AddressOf OnFrameChange))
    End Sub

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

        SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.DoubleBuffer Or ControlStyles.UserPaint, True)
    End Sub

    Private Sub OnFrameChange(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 MyBase.Paint
        If Not TankFillingLow Is Nothing Then
            ImageAnimator.UpdateFrames(TankFillingLow)
            Dim TempTankFillingLow As New Bitmap(TankFillingLow, TankFillingLow.Width, TankFillingLow.Height)
            TempTankFillingLow.MakeTransparent(TempTankFillingLow.GetPixel(0, 0))
            e.Graphics.DrawImage(TempTankFillingLow, 748, 462)
            TempTankFillingLow.Dispose()
        End If

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ImageAnimator.StopAnimate(TankFillingLow, New EventHandler(AddressOf OnFrameChange))
    End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top