.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 7th, 2003, 06:10 AM
Anibal Hernande Anibal Hernande is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 33 Anibal Hernande User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
Does anyone know how to play a GIF animation only once?

Does anyone know how to play a GIF animation only once?

I’m using ImageAnimator class with a GIF animation that was designed with Animation Shop 3 to play or loop only once. When using the code below the animation starts looping repeatedly.

Does anyone know the right code to play this GIF animation one time only?

Thanks

Andy

This is the code I’m using:
Code:
'Create a Bitmpap Object.
    Private WaterDropAnimation As New Bitmap("WaterDrop.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(WaterDropAnimation, 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)


        'Get the next frame ready for rendering.
        ImageAnimator.UpdateFrames()
        'WaterDropAnimation.MakeTransparent(WaterDropAnimation.GetPixel(0, 0))
        'Draw the next frame in the animation.
        e.Graphics.DrawImage(Me.WaterDropAnimation, New Point(125, 125))

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Begin the animation.
        AnimateImage()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If currentlyAnimating Then
            'Begin the animation only once.
            ImageAnimator.StopAnimate(WaterDropAnimation, New EventHandler(AddressOf Me.OnFrameChanged))
            currentlyAnimating = False
        End If
    End Sub

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Does anyone know how to play a GIF animation only once?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap