【VB开源代码栏目提醒】:本文主要为网学会员提供Timer.frm,希望对需要Timer.frm网友有所帮助,学习一下!
VERSION 5.00
Begin VB.Form Timer
Caption = "Form1"
ClientHeight = 2325
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 2325
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "暂停"
Height = 495
Left = 2760
TabIndex = 2
Top = 1200
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "计时"
Enabled = 0 'False
Height = 495
Left = 2760
TabIndex = 1
Top = 360
Width = 1335
End
Begin VB.Timer Timer1
Interval = 500
Left = 360
Top = 1320
End
Begin
VB.Label Label1
BorderStyle = 1 'Fixed Single
Caption = "Label1"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 0
Top = 480
Width = 2055
End
End
Attribute VB_Name = "Timer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Me.Timer1.Enabled = True
Me.Command1.Enabled = False
Me.Command2.Enabled = True
End Sub
Private Sub Command2_Click()
Me.Timer1 = False
Me.Command1.Enabled = True
Me.Command2.Enabled = False
End Sub
Private Sub Timer1_Timer()
If Label1.Caption <> CStr(Time) Then
Label1.Caption = Time
End If
End Sub