timerFlag=true
'在计时器时判定timerFlag为真时才计时!
if timerFlag then
'计时开始
if '退出条件 then exit sub
end if
'如果你想停止计时器,只需要把
if '退出条件 then timerFlag=false
'就行了! 想开始就设为trueDim i As Integer
Dim a As Integer
Dim b As Integer
Private Sub Label1_Click()
Label1Caption = Time
Timer1Enabled = True
End Sub
Private Sub Label2_Click()
Label2Caption = Time
Timer1Enabled = False
End Sub
Private Sub Timer1_Timer()
i = i + 1
If i >= 60 Then
a = a + 1
i = 0
End If
If a >= 60 Then
b = b + 1
End If
Label3Caption = b & ":" & a & ":" & i
End Sub
注:timer1enable=false
timer1interval=1000最简单的办法是做个菜单,菜单可以设置快捷键,剩下的你懂得
也可以这样:
Private
Sub
Form_KeyDown(KeyCode
As
Integer,
Shift
As
Integer)
If
KeyCode
=
vbKeyA
Then
End
End
Sub
Private
Sub
Form_Load()
MeKeyPreview
=
True
End
Sub
'按a键直接退出程序
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)