PDA

Click to See Complete Forum and Search --> : Animation


[EX]Mashine
Mar 18th, 2001, 07:59 AM
How can I place an animation on my form?

Sastraxi
Mar 18th, 2001, 09:18 AM
If it's an animated GIF then you need the AnimGIF control, but if it's a series of bitmaps, load them into an array of pictureboxes at runtime. Make another picturebox and add a timer...


Option Explicit
Dim A as Integer
Private Sub Form_Load()
A = 0
End Sub
Private Sub Timer1_Timer()
A = A + 1
If A > Ubound(Picture1) Then A = 0
Picture2.Picture = Picture1(A).Picture
End Sub


What this code does is increment A every time the timer triggers, causing the animation frame to go up one. If the frame number is too high then it sets it to 0, and then it displays it in the picturebox.