VERSION 5.00
Begin VB.Form FrmStopwatch 
   BackColor       =   &H00C0FFFF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "计时秒表"
   ClientHeight    =   1575
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   3345
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1575
   ScaleWidth      =   3345
   StartUpPosition =   3  '窗口缺省
   Begin VB.Timer TmrStopwatch 
      Interval        =   100
      Left            =   2400
      Top             =   0
   End
   Begin VB.CommandButton CmdClear 
      BackColor       =   &H00C0FFFF&
      Caption         =   "清零"
      Height          =   375
      Left            =   2280
      MaskColor       =   &H8000000F&
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   1080
      Width           =   975
   End
   Begin VB.CommandButton CmdStop 
      BackColor       =   &H00C0FFFF&
      Caption         =   "停止计时"
      Height          =   375
      Left            =   1200
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   1080
      Width           =   975
   End
   Begin VB.CommandButton CmdBegin 
      BackColor       =   &H00C0FFFF&
      Caption         =   "开始计时"
      Height          =   375
      Left            =   120
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   1080
      Width           =   975
   End
   Begin VB.Label LblClock 
      Alignment       =   2  'Center
      BackColor       =   &H00C0FFFF&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   36
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   240
      TabIndex        =   3
      Top             =   240
      Width           =   3015
   End
End
Attribute VB_Name = "FrmStopwatch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim s As Single
Private Sub Form_Load()
   CmdClear.Enabled = False      '清零按钮不可用
   CmdStop.Enabled = False       '停止计时按钮不可用
   TmrStopwatch.Enabled = False  '计时控件不可用
   LblClock.Caption = Format(0, "00.00") + "秒"  '显示计时初值
   s = 0
End Sub
Rem 开始计时
Private Sub CmdBegin_Click()
   s = Timer                     '给出午夜0点以来的时间
   TmrStopwatch.Enabled = True   '计时控件可用
   CmdBegin.Enabled = False      '开始按钮不可用
   CmdClear.Enabled = False      '清零按钮不可用
   CmdStop.Enabled = True        '停止计时按钮可用
End Sub
Rem 计时过程
Private Sub TmrStopwatch_Timer()
  a = Timer - s                      '以秒为单位的计时
  a = Format(a, "00.00")             '计时数值的格式为两位整数两位小数
  LblClock.Caption = CStr(a) + "秒"  '显示计时
End Sub
Rem 停止计时
Private Sub CmdStop_Click()
   TmrStopwatch.Enabled = False  '计时控件不可用
   CmdClear.Enabled = True       '清零按钮可用
   CmdStop.Enabled = False       '停止计时按钮不可用
   CmdBegin.Enabled = False      '开始按钮不可用
End Sub
Rem 计时清零
Private Sub CmdClear_Click()
   CmdBegin.Enabled = True       '开始按钮可用
   CmdStop.Enabled = False       '停止计时按钮不可用
   CmdClear.Enabled = False      '清零按钮不可用
   TmrStopwatch.Enabled = False  '计时控件不可用
   LblClock.Caption = Format(0, "00.00") + "秒"  '显示计时初值
   s = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
   Unload Me
   Frmsys.Show
End Sub

