Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleAnimate a series of bitmaps stored in in PictureBoxes
Keywordsanimation, bitmap, animate, multimedia
CategoriesMultimedia, Graphics
 
Store the frame images in PictureBoxes with Visible = False. When a Timer fires, copy the next frame's picture into a visible PictureBox. This program loops forward and backward through frames 0 to 10.
 
Private Sub tmrNextFrame_Timer()
Static next_frame As Integer
Static d_frame As Integer

    If d_frame = 0 Then d_frame = 1
    next_frame = next_frame + d_frame
    If next_frame > picFrame.UBound Then
        next_frame = picFrame.UBound
        d_frame = -1
    ElseIf next_frame < 0 Then
        next_frame = 0
        d_frame = 1
    End If

    picScreen.Picture = picFrame(next_frame).Picture
    DoEvents
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated