CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Animation

  1. #1
    Join Date
    Nov 2000
    Location
    IL, U.S.A.
    Posts
    218

    Animation

    This code plays a gif file on my form. How can I change the code to play the file just once.

    private Sub tmrAnimation_Timer()
    static intAnimate as Integer
    static intUnload as Integer
    static intUpDown as Integer
    intAnimate = intAnimate + 1

    If intAnimate < 9 then
    imgShow.Picture = imgLogo(intAnimate).Picture

    else
    imgShow.Picture = imgLogo(9).Picture
    intAnimate = 0
    intUnload = intUnload + 1
    End If
    End Sub





  2. #2
    Join Date
    Nov 2000
    Location
    Ohio
    Posts
    238

    Re: Animation

    I figure there are probably lots of ways to only play it once.

    One would be... turn the timer off after the last frame of the animation plays

    Two.. do not reset the intAnimate variable and do:
    If intAnimate = 9 then Exit Sub
    as the first line of the sub

    Three.. Do not use a timer loop at all.. if you only want the animation to run one time just create a subroutine dedicated to playing the animation, then just call it once.

    I would try NOT using timers as much as possible. I am sure there are plenty of other ways to do what you want to do.. thats just a couple suggestions.

    Good Luck
    Joe



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured