|
-
May 4th, 2010, 12:53 PM
#1
Animation with 5 picture boxes using VB.NET
Hello!
I'm trying to create an animation with 5 picture boxes (labeled picturebox0 - picturebox4) but I have a specific order I want them to display. I made 5 picture boxes, added images to them, and stack them on top of each other.
I want the order to show this:
picturebox 0, 1, 4, 3, 2, 4, 2, 3, 1, 3... etc
The code I have using if-else statements which would work if I wanted to repeat the same display pattern but I need to manually right the pattern... How would I do that? I have at timer set to change the pictures every 2.5 seconds.
Code:
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
System.Threading.Thread.Sleep(1000)
If PictureBox0.Visible = True Then
PictureBox0.Visible = False
PictureBox1.Visible = True
ElseIf PictureBox1.Visible = True Then 'up arrow displayed
PictureBox1.Visible = False
PictureBox4.Visible = True
ElseIf PictureBox4.Visible = True Then 'left arrow displayed
PictureBox4.Visible = False
PictureBox3.Visible = True
ElseIf PictureBox3.Visible = True Then 'down arrow displayed
PictureBox3.Visible = False
PictureBox2.Visible = True
ElseIf PictureBox2.Visible = True Then 'right arrow displayed
PictureBox2.Visible = False
PictureBox4.Visible = True
ElseIf PictureBox4.Visible = True Then 'left
PictureBox4.Visible = False
PictureBox2.Visible = True
ElseIf PictureBox2.Visible = True Then 'right
PictureBox2.Visible = False
PictureBox3.Visible = True
ElseIf PictureBox3.Visible = True Then 'down
PictureBox3.Visible = False
PictureBox2.Visible = True
ElseIf PictureBox1.Visible = True Then 'up
PictureBox1.Visible = False
PictureBox3.Visible = True
ElseIf PictureBox3.Visible = True Then 'down
PictureBox3.Visible = False
PictureBox2.Visible = True
ElseIf PictureBox2.Visible = True Then 'right
PictureBox2.Visible = False
PictureBox4.Visible = True
ElseIf PictureBox4.Visible = True Then '
PictureBox1.Visible = False
PictureBox2.Visible = True
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|