📄 frmstopwatch.frm
字号:
VERSION 5.00
Begin VB.Form frmstopwatch
Caption = "Form1"
ClientHeight = 1950
ClientLeft = 60
ClientTop = 345
ClientWidth = 5385
LinkTopic = "Form1"
ScaleHeight = 1950
ScaleWidth = 5385
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdStartStop
Caption = "开始"
Height = 525
Left = 3435
TabIndex = 2
Top = 0
Width = 1440
End
Begin VB.CommandButton cmdReset
Caption = "清零"
Height = 540
Left = 3450
TabIndex = 1
Top = 705
Width = 1410
End
Begin VB.TextBox txtDisplay
Height = 615
Left = 60
TabIndex = 0
Top = 150
Width = 2580
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 500
Left = 0
Top = 945
End
End
Attribute VB_Name = "frmstopwatch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim myStopWatch As stopwatch
Private Sub Form_Load()
Set myStopWatch = New stopwatch
txtDisplay.Text = CDate(0)
End Sub
Private Sub cmdStartStop_Click()
If myStopWatch.Run = True Then
myStopWatch.StopIt
txtDisplay.Text = CDate(myStopWatch.TimeSum)
cmdStartStop.Caption = "运行"
Timer1.Enabled = False
Else
myStopWatch.Start
cmdStartStop.Caption = "暂停"
Timer1.Enabled = True
End If
End Sub
Private Sub Timer1_Timer()
txtDisplay.Text = CDate(myStopWatch.TimeSum + (Now - myStopWatch.StartTime))
End Sub
Private Sub cmdReset_Click()
myStopWatch.Reset
Timer1.Enabled = False
txtDisplay.Text = CDate(0)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -