Dim MoveRight As Boolean
Dim MoveRight As Boolean
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly1.gif")
Timer2.Enabled = True
Timer1.Enabled = False
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly2.gif")
Timer3.Enabled = True
Timer2.Enabled = False
End Sub
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly3.gif")
Timer4.Enabled = True
Timer3.Enabled = False
End Sub
Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly4.gif")
Timer5.Enabled = True
Timer4.Enabled = False
End Sub
Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer5.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly5.gif")
Timer6.Enabled = True
Timer5.Enabled = False
End Sub
Private Sub Timer6_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer6.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly6.gif")
Timer7.Enabled = True
Timer6.Enabled = False
End Sub
Private Sub Timer7_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer7.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly5.gif")
Timer8.Enabled = True
Timer7.Enabled = False
End Sub
Private Sub Timer8_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer8.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly4.gif")
Timer9.Enabled = True
Timer8.Enabled = False
End Sub
Private Sub Timer9_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer9.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly3.gif")
Timer10.Enabled = True
Timer9.Enabled = False
End Sub
Private Sub Timer10_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer10.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly2.gif")
Timer11.Enabled = True
Timer10.Enabled = False
End Sub
Private Sub Timer11_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer11.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly1.gif")
Timer12.Enabled = True
Timer11.Enabled = False
End Sub
Private Sub Timer12_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer12.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly1.gif")
Timer1.Enabled = True
Timer12.Enabled = False
End Sub
Private Sub Timer13_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer13.Tick
If MoveRight = True Then
PictureBox1.Left += 10
Else
PictureBox1.Left -= 10
End If
If Moveup = True Then
PictureBox1.Top -= 10
Else
PictureBox1.Top += 10
End If
If PictureBox1.Left <= Me.PictureBox1.SizeMode Then
MoveRight = True
End If
If PictureBox1.Left + PictureBox1.Width >= Me.PictureBox1.SizeMode Then
MoveRight = False
End If
If PictureBox1.Top <= Me.PictureBox1.Top Then
Moveup = False
End If
If PictureBox1.Top + PictureBox1.Height >= Me.PictureBox1.Bottom Then
Moveup = True
End If
End Sub
End Class
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly1.gif")
Timer2.Enabled = True
Timer1.Enabled = False
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly2.gif")
Timer3.Enabled = True
Timer2.Enabled = False
End Sub
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly3.gif")
Timer4.Enabled = True
Timer3.Enabled = False
End Sub
Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly4.gif")
Timer5.Enabled = True
Timer4.Enabled = False
End Sub
Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer5.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly5.gif")
Timer6.Enabled = True
Timer5.Enabled = False
End Sub
Private Sub Timer6_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer6.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly6.gif")
Timer7.Enabled = True
Timer6.Enabled = False
End Sub
Private Sub Timer7_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer7.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly5.gif")
Timer8.Enabled = True
Timer7.Enabled = False
End Sub
Private Sub Timer8_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer8.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly4.gif")
Timer9.Enabled = True
Timer8.Enabled = False
End Sub
Private Sub Timer9_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer9.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly3.gif")
Timer10.Enabled = True
Timer9.Enabled = False
End Sub
Private Sub Timer10_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer10.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly2.gif")
Timer11.Enabled = True
Timer10.Enabled = False
End Sub
Private Sub Timer11_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer11.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly1.gif")
Timer12.Enabled = True
Timer11.Enabled = False
End Sub
Private Sub Timer12_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer12.Tick
PictureBox1.Image = Image.FromFile("C:\Users\Adrian\Documents\but\Butterfly1.gif")
Timer1.Enabled = True
Timer12.Enabled = False
End Sub
Private Sub Timer13_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer13.Tick
If MoveRight = True Then
PictureBox1.Left += 10
Else
PictureBox1.Left -= 10
End If
If Moveup = True Then
PictureBox1.Top -= 10
Else
PictureBox1.Top += 10
End If
If PictureBox1.Left <= Me.PictureBox1.SizeMode Then
MoveRight = True
End If
If PictureBox1.Left + PictureBox1.Width >= Me.PictureBox1.SizeMode Then
MoveRight = False
End If
If PictureBox1.Top <= Me.PictureBox1.Top Then
Moveup = False
End If
If PictureBox1.Top + PictureBox1.Height >= Me.PictureBox1.Bottom Then
Moveup = True
End If
End Sub
End Class
Daneil 0 Newbie Poster
Reverend Jim 4,968 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Daneil 0 Newbie Poster
Reverend Jim 4,968 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Reverend Jim 4,968 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
EMMAGERALD 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.