-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnimation.vb
91 lines (78 loc) · 3.37 KB
/
Animation.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
REM Animation Demonstration
REM By Michael Dao
REM Demonstrates how to move a picture around the screen using buttons, how to shrink or enlarge a picture and how to automatically move a picture.
REM Started: 31/03/2014
Public Class frmAnimation
Private Sub frmSpace_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
REM Default values
lblLeft.Text = picSpaceShip.Left
lblUp.Text = picSpaceShip.Top
lblSize.Text = picSpaceShip.Width
tmrAuto.Enabled = False
End Sub
Private Sub btnLeft_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLeft.Click
REM Move the spaceship left
picSpaceShip.Left = picSpaceShip.Left - 5
lblLeft.Text = picSpaceShip.Left
End Sub
Private Sub btnRight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRight.Click
REM Move the spaceship Right
picSpaceShip.Left += 5
lblLeft.Text = picSpaceShip.Left
End Sub
Private Sub btnUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUp.Click
REM Move the spaceship up
picSpaceShip.Top -= 5
lblUp.Text = picSpaceShip.Top
End Sub
Private Sub btnDown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDown.Click
REM Move the spaceship down
picSpaceShip.Top += 5
lblUp.Text = picSpaceShip.Top
End Sub
Private Sub btnLarger_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLarger.Click
REM Make sure the spaceship bigger
picSpaceShip.Width += 3
picSpaceShip.Height += 3
lblSize.Text = picSpaceShip.Width
End Sub
Private Sub btnSmaller_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSmaller.Click
REM Make sure the spaceship smaller
picSpaceShip.Width -= 3
picSpaceShip.Height -= 3
lblSize.Text = picSpaceShip.Width
End Sub
Private Sub btnFlyManual_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFlyManual.Click
REM Make the spaceship move down, right and get larger
picSpaceShip.Top += 5
picSpaceShip.Left += 3
picSpaceShip.Width += 2
picSpaceShip.Height += 2
REM Put the numbers into labels
lblLeft.Text = picSpaceShip.Left
lblUp.Text = picSpaceShip.Top
lblSize.Text = picSpaceShip.Width
End Sub
Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
'back to the menu
Me.Close()
frmMenu.Show()
End Sub
Private Sub btnFly_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFly.Click
REM Reset the spaceship
Call Reset()
REM Start the time
tmrAuto.Enabled = True
End Sub
Private Sub tmrAuto_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrAuto.Tick
REM Make the ship move down, right and get bigger
picSpaceShip.Top += 5
picSpaceShip.Left += 3
picSpaceShip.Width += 2
picSpaceShip.Height += 2
REM Put the numbers into labels
lblLeft.Text = picSpaceShip.Left
lblUp.Text = picSpaceShip.Top
lblSize.Text = picSpaceShip.Width
End Sub
End Class