以下是引用wangkaicosl在2015-1-15 16:23:26的发言:
Public Class Form1
Dim i0, i1, i2, i3, x As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load
x = 400
i1 = Val(TextBox1.Text)
i2 = Val(TextBox2.Text)
i3 = Val(TextBox3.Text)
i0 = i1 + i2 + i3 + i2
Timer1.Interval = 100
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static i As Integer, dx%
Dim k%
i = i + 1
If i <= i1 * 10 Then
PictureBox4.Image = PictureBox1.Image
k = 1
ElseIf i <= (i1 + i2) * 10 Then
PictureBox4.Image = PictureBox2.Image
k = 2
ElseIf i <= (i1 + i2 + i3) * 10 Then
PictureBox4.Image = PictureBox3.Image
k = 3
ElseIf i <= i0 * 10 Then
PictureBox4.Image = PictureBox2.Image
k = 2
If i = i0 * 10 Then i = 0
End If
If k = 3 Then
If dx < 4 Then dx = dx + 1
Else
If x > 130 Or x < 100 Then
dx = 4
ElseIf x > 120 Then
dx = 3
ElseIf x > 110 Then
dx = 2
ElseIf x > 100 Then
dx = 1
Else
dx = 0
End If
End If
x = x - dx
If x <= -100 Then x = 400
PictureBox5.Left = x
End Sub
End Class
Public Class Form1
Dim i0, i1, i2, i3, x As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load
x = 400
i1 = Val(TextBox1.Text)
i2 = Val(TextBox2.Text)
i3 = Val(TextBox3.Text)
i0 = i1 + i2 + i3 + i2
Timer1.Interval = 100
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static i As Integer, dx%
Dim k%
i = i + 1
If i <= i1 * 10 Then
PictureBox4.Image = PictureBox1.Image
k = 1
ElseIf i <= (i1 + i2) * 10 Then
PictureBox4.Image = PictureBox2.Image
k = 2
ElseIf i <= (i1 + i2 + i3) * 10 Then
PictureBox4.Image = PictureBox3.Image
k = 3
ElseIf i <= i0 * 10 Then
PictureBox4.Image = PictureBox2.Image
k = 2
If i = i0 * 10 Then i = 0
End If
If k = 3 Then
If dx < 4 Then dx = dx + 1
Else
If x > 130 Or x < 100 Then
dx = 4
ElseIf x > 120 Then
dx = 3
ElseIf x > 110 Then
dx = 2
ElseIf x > 100 Then
dx = 1
Else
dx = 0
End If
End If
x = x - dx
If x <= -100 Then x = 400
PictureBox5.Left = x
End Sub
End Class
说白点就是你买了苹果你要告诉计算机它是苹果,然后开始买了三个个苹果,后来买五苹果那一起就8个苹果就这意思 Dim i0, i1, i2, i3, x As Integer
Private Sub Command1_Click()
i1 = 3
i2 = 5
Print "i1 + i2=8"
End Sub