⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 例8.frm

📁 在VB5环境下开发的VB程序集,窗体控件源代码.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Frm7_7_2 
   BackColor       =   &H0080FF80&
   Caption         =   "Timer 设计实例1--秒表制作"
   ClientHeight    =   3780
   ClientLeft      =   690
   ClientTop       =   1875
   ClientWidth     =   7800
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   18
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   3780
   ScaleWidth      =   7800
   Begin VB.OptionButton Option2 
      BackColor       =   &H000000FF&
      Caption         =   "0.1秒"
      Height          =   615
      Left            =   6000
      TabIndex        =   5
      Top             =   1080
      Width           =   1335
   End
   Begin VB.OptionButton Option1 
      BackColor       =   &H00FF00FF&
      Caption         =   "秒"
      Height          =   615
      Left            =   4680
      TabIndex        =   4
      Top             =   1080
      Width           =   1095
   End
   Begin VB.CommandButton Command2 
      Caption         =   "停止"
      Height          =   495
      Left            =   2280
      TabIndex        =   3
      Top             =   1200
      Width           =   1455
   End
   Begin VB.CommandButton Command1 
      Caption         =   "启动"
      Height          =   495
      Left            =   360
      TabIndex        =   2
      Top             =   1200
      Width           =   1575
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   2280
      TabIndex        =   1
      Top             =   360
      Width           =   1455
   End
   Begin VB.Timer Timer1 
      Left            =   7320
      Top             =   360
   End
   Begin VB.Label Label4 
      BackColor       =   &H000000FF&
      Caption         =   "问题2:如何设置秒表的启停?"
      Height          =   495
      Left            =   1080
      TabIndex        =   8
      Top             =   2880
      Width           =   4935
   End
   Begin VB.Label Label3 
      BackColor       =   &H0000FFFF&
      Caption         =   "问题1:时间单位如何设定?"
      Height          =   495
      Left            =   1080
      TabIndex        =   7
      Top             =   2160
      Width           =   4935
   End
   Begin VB.Label Label2 
      BackColor       =   &H0000FFFF&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "单位设定"
      Height          =   495
      Left            =   5280
      TabIndex        =   6
      Top             =   360
      Width           =   1575
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFFFFF&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "  计 时"
      Height          =   495
      Left            =   360
      TabIndex        =   0
      Top             =   360
      Width           =   1575
   End
End
Attribute VB_Name = "Frm7_7_2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim t As Integer

Private Sub Command1_Click()
Timer1.Enabled = True
t = 0
Text1 = ""
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
End Sub

Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1000
End Sub

Private Sub Option1_Click()
If Option1.Value = True Then
Timer1.Interval = 1000
t = 0
End If
End Sub

Private Sub Option2_Click()
If Option2.Value = True Then
Timer1.Interval = 100
t = 0
End If
End Sub

Private Sub Timer1_Timer()
t = t + 1
Text1 = t
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -