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

📄 数字游戏.frm

📁 此文件包含5至6个用VB语言写的小程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form 数字游戏 
   Caption         =   "数字游戏"
   ClientHeight    =   5355
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7515
   LinkTopic       =   "Form1"
   ScaleHeight     =   5355
   ScaleWidth      =   7515
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "退出"
      Height          =   615
      Left            =   1800
      TabIndex        =   7
      Top             =   4680
      Width           =   4575
   End
   Begin VB.Timer Timer3 
      Enabled         =   0   'False
      Interval        =   600
      Left            =   6360
      Top             =   480
   End
   Begin VB.Timer Timer2 
      Enabled         =   0   'False
      Interval        =   500
      Left            =   5640
      Top             =   480
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   300
      Left            =   480
      Top             =   720
   End
   Begin VB.CommandButton stopCommand3 
      Caption         =   "停止"
      Enabled         =   0   'False
      Height          =   1095
      Left            =   5400
      TabIndex        =   6
      Top             =   3480
      Width           =   1575
   End
   Begin VB.CommandButton stopCommand2 
      Caption         =   "停止"
      Enabled         =   0   'False
      Height          =   975
      Left            =   3360
      TabIndex        =   5
      Top             =   3360
      Width           =   1335
   End
   Begin VB.CommandButton stopCommand1 
      Caption         =   "停止"
      Enabled         =   0   'False
      Height          =   855
      Left            =   840
      TabIndex        =   4
      Top             =   3360
      Width           =   1335
   End
   Begin VB.CommandButton startCommand1 
      Caption         =   "开始"
      Height          =   1095
      Left            =   2040
      TabIndex        =   3
      Top             =   240
      Width           =   3135
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      Caption         =   "0"
      Height          =   1335
      Left            =   5400
      TabIndex        =   2
      Top             =   1680
      Width           =   1455
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      Caption         =   "0"
      Height          =   1335
      Left            =   3240
      TabIndex        =   1
      Top             =   1680
      Width           =   1215
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Caption         =   "0"
      Height          =   1215
      Left            =   720
      TabIndex        =   0
      Top             =   1680
      Width           =   1215
   End
End
Attribute VB_Name = "数字游戏"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer, j As Integer, k As Integer


Private Sub Command1_Click()
Unload Me
End Sub

Private Sub startCommand1_Click()
Timer1.Enabled = True
Timer2.Enabled = True
Timer3.Enabled = True
stopCommand1.Enabled = True
stopCommand2.Enabled = True
stopCommand3.Enabled = True
startCommand1.Caption = Format(Int(1000 * Rnd), "000")
End Sub

Private Sub stopCommand1_Click()
Dim number As Integer
Timer1.Enabled = False
If Not (Timer1.Enabled Or Timer2.Enabled Or Timer3.Enabled) Then
number = Label1.Caption * 100 + Label2.Caption * 10 + Label3.Caption
If startCommand1.Caption = number Then
MsgBox "congratuations"
End If
startCommand1.Caption = "开始"
End If
End Sub

Private Sub stopCommand2_Click()
Dim number As Integer
Timer2.Enabled = False
If Not (Timer1.Enabled Or Timer2.Enabled Or Timer3.Enabled) Then
number = Label1.Caption * 100 + Label2.Caption * 10 + Label3.Caption
If startCommand1.Caption = number Then
MsgBox "congratuations"
End If
startCommand1.Caption = "开始"
End If
End Sub

Private Sub stopCommand3_Click()
Dim number As Integer
Timer3.Enabled = False
If Not (Timer1.Enabled Or Timer2.Enabled Or Timer3.Enabled) Then
number = Label1.Caption * 100 + Label2.Caption * 10 + Label3.Caption
If startCommand1.Caption = number Then
MsgBox "congratuations"
End If
startCommand1.Caption = "开始"
End If
End Sub

Private Sub Timer1_Timer()
Label1.Caption = i            '在标签中显示数字。
If i = 9 Then
i = 0
Else: i = i + 1
End If                              'i自动加一或回零。
End Sub                             '每隔一段时间执行一下程序。
Private Sub Timer2_Timer()
Label2.Caption = j            '在标签中显示数字。
If j = 9 Then
j = 0
Else: j = j + 1
End If                              'i自动加一或回零。
End Sub

Private Sub Timer3_Timer()
Label3.Caption = k           '在标签中显示数字。
If k = 9 Then
k = 0
Else: k = k + 1
End If                              'i自动加一或回零。
End Sub

⌨️ 快捷键说明

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