时钟控件循环触发按扭延伸版

这是刚才问的:check1是用来判断时钟控件的,如果打钩那么时钟控件为true反之为false而text1是来定义时钟控件的时间的,还有button控件若干个.如果定义时... 这是刚才问的:
check1是用来判断时钟控件的, 如果打钩 那么 时钟控件为true 反之为false
而text1是来定义时钟控件的时间的,还有button控件若干个.
如果定义时钟控件的时间为5秒,那么例如我有4个button,5秒之后触发button1,10秒之后触发button2,15秒之后触发button3,20秒之后触发button4,25秒之后再从头开始触发button1,然后依次5秒之后触发button2,button3,button4.以此循环, 请问 这样的程序该怎么写?

我鬼主意很多,- -, 现在我想在这个问题的前提下再多加4个按妞。分别对应上面的那个4个按妞。1对应5,2对应6,3对应7,4对应8。
按妞5,6,7,8是来选择要触发哪个按妞的. 如果我按了5,6,7,8然后选择时间为3秒,并且打勾,那么3秒之后触发1,6秒之后触发2,9秒之后触发3,12秒之后触发4, 关键来了!!!! 如果我选择了5,7,8 那么要怎么跳过6? 让程序3秒之后触发1,6秒之后触发7,9秒之后触发8然后依次循环?
展开
 我来答
mosquitokobe
2009-01-18 · TA获得超过4253个赞
知道大有可为答主
回答量:5008
采纳率:50%
帮助的人:0
展开全部
Dim a As Integer
Private Sub Check1_Click()
Timer1.Enabled = IIf(Check1.Value = 1, True, False)
If Timer1.Enabled = False Then a = 0
End Sub
Private Sub Command1_Click()
Print "按钮1事件触发"
End Sub
Private Sub Command2_Click()
Print "按钮2事件触发"
End Sub
Private Sub Command3_Click()
Print "按钮3事件触发"
End Sub
Private Sub Command4_Click()
Print "按钮4事件触发"
End Sub

Private Sub Command5_Click()
Command1.Enabled = IIf(Command1.Enabled = False, True, False)
End Sub
Private Sub Command6_Click()
Command2.Enabled = IIf(Command2.Enabled = False, True, False)
End Sub
Private Sub Command7_Click()
Command3.Enabled = IIf(Command3.Enabled = False, True, False)
End Sub
Private Sub Command8_Click()
Command4.Enabled = IIf(Command4.Enabled = False, True, False)
End Sub
Private Sub Form_Load()
Text1.Text = ""
a = 0
Timer1.Enabled = False
Timer1.Interval = 1000
End Sub

Private Sub Timer1_Timer()
Dim s As Integer
s = Int(Val(Text1.Text))
a = a + 1
i = 0

If Command1.Enabled = True Then
i = i + 1
If a = i * s Then Command1_Click
End If

If Command2.Enabled = True Then
i = i + 1
If a = i * s Then Command2_Click
End If

If Command3.Enabled = True Then
i = i + 1
If a = i * s Then Command3_Click
End If

If Command4.Enabled = True Then
i = i + 1
If a = i * s Then Command4_Click
End If

If a = i * s Then a = 0: i = 0
End Sub
hoyogoo
2009-01-18 · TA获得超过177个赞
知道小有建树答主
回答量:209
采纳率:0%
帮助的人:184万
展开全部
Dim a As Long
Dim b As Long
Dim c As Long

Private Sub Check5_Click()
If Check5.Value = False Then
Timer1.Enabled = False
End If
End Sub

Private Sub Command1_Click()
Label1.BackColor = &HFF& '这里是模拟作工
Label4.BackColor = &H8000000A '清除作工被存储的颜色,非文本显示工作可不用
Label3.BackColor = &H8000000A
Label2.BackColor = &H8000000A
End Sub

Private Sub Command2_Click()
Label2.BackColor = &HFF&
Label1.BackColor = &H8000000A
Label4.BackColor = &H8000000A
Label3.BackColor = &H8000000A
End Sub

Private Sub Command3_Click()
Label3.BackColor = &HFF&
Label2.BackColor = &H8000000A
Label1.BackColor = &H8000000A
Label4.BackColor = &H8000000A
End Sub

Private Sub Command4_Click()
Label4.BackColor = &HFF&
Label3.BackColor = &H8000000A
Label2.BackColor = &H8000000A
Label1.BackColor = &H8000000A
End Sub
Private Sub Command5_Click()
If Check5.Value = 1 Then
Timer1.Enabled = True
End If
b = 0
a = Text1.Text
c = 4
d = 0
End Sub

Private Sub Timer1_Timer()
Dim d As Long
For i = 0 To 3
If Check1(i).Value = 1 Then
d = 1
End If
Next i
If d = 1 Then
b = b + 1

If b Mod a = 0 Then
Select Case c
Case 1
E1:
If Check1(1).Value = 1 Then
Call Command2_Click
c = 2
Else
GoTo E2:
End If
Case 2
E2:
If Check1(2).Value = 1 Then
Call Command3_Click
c = 3
Else
GoTo E3:
End If
Case 3
E3:
If Check1(3).Value = 1 Then
Call Command4_Click
c = 4
Else
GoTo E4:
End If
Case 4
E4:
If Check1(0).Value = 1 Then
Call Command1_Click
c = 1
Else
GoTo E1:
End If

End Select
End If
Else
MsgBox "没有需要出发的时间,程序结束"
Timer1.Enabled = False
End If
End Sub
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式