VB中的时钟控件Timer,我想实现倒计时,可倒计时是从窗体一加载就开始了,可我想点击Commond之后再进行倒计时,如何实现?
VB中的时钟控件Timer,我想实现倒计时,可倒计时是从窗体一加载就开始了,可我想点击Commond之后再进行倒计时,如何实现?
[解决办法]
设计时 timer.Enable=false
sub command_click()
timer.enable=true
....
end sub
[解决办法]
Dim i As Integer
Private Sub Form_Load()
i = InputBox( "输入倒记时起点 ")
Timer1.Enabled = True
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Cls
i = i - 1
Print " 倒数 " & i & " 秒 "
If i <= 0 Then
Timer1.Enabled = False
End If
End Sub