
VB高手来解答,高分悬赏,速度 35
此程序是一组动画,在cars1=1时,执行动画开车库门,开门动作完则开道杆;问题在此当earth=1时,想先关道杆,但是关道杆的动作却是个死循环,只能出现3张图片(原有5...
此程序是一组动画,在cars1=1时,执行动画开车库门,开门动作完则开道杆;问题在此当earth=1时,想先关道杆,但是关道杆的动作却是个死循环,只能出现3张图片(原有5张)。
将程序改为 先开杆-再开门-earth=1时关杆,动画就是对的。
或者 先开门-再开杆-同时关门关杆,动画也是对的。
求救啊,小妹只有30分倾囊相送了!!!!!!急啊急啊!!!下附程序
Dim keep As Boolean
Dim cars1, cars2, earths, carp As Boolean
Dim i, j As Integer
Dim bopen, bclose As Boolean
Dim dopen, dclose As Boolean
Private Sub Command1_Click()
keep = True
Command1.Enabled = False
End Sub
Private Sub Timer1_Timer()
If keep = True Then
Image1(0).Left = Image1(0).Left + 50
Image1(0).Top = (Line1.Y2 - Line1.Y1) / (Line1.X2 - Line1.X1) * (Image1(0).Left - Line1.X1) + Line1.Y1 - 1320
If cars1 = 1 Then
dopen = 1
End If
If j = 5 Then
bopen = 1
End If
If earths = 1 Then
bclose = True '这里有问题
End If
End If
End Sub
Private Sub Timer2_Timer()
If keep = True And 2040 < Image1(0).Left And Image1(0).Left < 4680 Then
cars1 = 1
Shape1.BackColor = &HFF&
Else
cars1 = 0
Shape1.BackColor = &HFFFFFF
End If
If keep = True And 6000 < Image1(0).Left And Image1(0).Left < 8760 Then
earths = 1
Shape2.BackColor = &HFF&
Else
Shape2.BackColor = &HFFFFFF
earths = 0
End If
End Sub
Private Sub Timer4_Timer()
If dopen = 1 And j < 5 Then
j = j + 1
Image4(j).Visible = True
Image4(j - 1).Visible = False
If j = 5 Then
dopen = 0
End If
End If
If dclose = True And j > 0 Then
j = j - 1
Image4(j).Visible = True
Image4(j + 1).Visible = False
If j = 0 Then
dclose = False
End If
End If
End Sub
Private Sub Timer3_Timer()
If bopen = 1 And i < 4 Then
i = i + 1
Image3(i).Visible = True
Image3(i - 1).Visible = False
If i = 4 Then
bopen = 0
End If
End If
If bclose = True And i > 0 Then
i = i - 1
Image3(i).Visible = True
Image3(i + 1).Visible = False
Print i
End If
If i = 0 Then
bclose = False
End If
End Sub
对了 开门是dopen 关门是dclose 开杆是bopen 关杆是bclose 现在的bclose 中的print i结果是3,2,2,2,2,2,2,2,2,2,2,2·····这是怎么回事啊
我看了一楼的回答还是不解,i,j是整型,今天修改了timer的频率属性,发现只能出现3,3,3,3,3,3,3~~~~~了,我想请问是否与多个timer同时使用的的频率设置有关。 展开
将程序改为 先开杆-再开门-earth=1时关杆,动画就是对的。
或者 先开门-再开杆-同时关门关杆,动画也是对的。
求救啊,小妹只有30分倾囊相送了!!!!!!急啊急啊!!!下附程序
Dim keep As Boolean
Dim cars1, cars2, earths, carp As Boolean
Dim i, j As Integer
Dim bopen, bclose As Boolean
Dim dopen, dclose As Boolean
Private Sub Command1_Click()
keep = True
Command1.Enabled = False
End Sub
Private Sub Timer1_Timer()
If keep = True Then
Image1(0).Left = Image1(0).Left + 50
Image1(0).Top = (Line1.Y2 - Line1.Y1) / (Line1.X2 - Line1.X1) * (Image1(0).Left - Line1.X1) + Line1.Y1 - 1320
If cars1 = 1 Then
dopen = 1
End If
If j = 5 Then
bopen = 1
End If
If earths = 1 Then
bclose = True '这里有问题
End If
End If
End Sub
Private Sub Timer2_Timer()
If keep = True And 2040 < Image1(0).Left And Image1(0).Left < 4680 Then
cars1 = 1
Shape1.BackColor = &HFF&
Else
cars1 = 0
Shape1.BackColor = &HFFFFFF
End If
If keep = True And 6000 < Image1(0).Left And Image1(0).Left < 8760 Then
earths = 1
Shape2.BackColor = &HFF&
Else
Shape2.BackColor = &HFFFFFF
earths = 0
End If
End Sub
Private Sub Timer4_Timer()
If dopen = 1 And j < 5 Then
j = j + 1
Image4(j).Visible = True
Image4(j - 1).Visible = False
If j = 5 Then
dopen = 0
End If
End If
If dclose = True And j > 0 Then
j = j - 1
Image4(j).Visible = True
Image4(j + 1).Visible = False
If j = 0 Then
dclose = False
End If
End If
End Sub
Private Sub Timer3_Timer()
If bopen = 1 And i < 4 Then
i = i + 1
Image3(i).Visible = True
Image3(i - 1).Visible = False
If i = 4 Then
bopen = 0
End If
End If
If bclose = True And i > 0 Then
i = i - 1
Image3(i).Visible = True
Image3(i + 1).Visible = False
Print i
End If
If i = 0 Then
bclose = False
End If
End Sub
对了 开门是dopen 关门是dclose 开杆是bopen 关杆是bclose 现在的bclose 中的print i结果是3,2,2,2,2,2,2,2,2,2,2,2·····这是怎么回事啊
我看了一楼的回答还是不解,i,j是整型,今天修改了timer的频率属性,发现只能出现3,3,3,3,3,3,3~~~~~了,我想请问是否与多个timer同时使用的的频率设置有关。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询