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

📄 form1.frm

📁 实现简单的打字游戏 让大家练习并提供免费下载
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1 
   Caption         =   "打字练习"
   ClientHeight    =   8430
   ClientLeft      =   4005
   ClientTop       =   2175
   ClientWidth     =   10740
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   8430
   ScaleWidth      =   10740
   Begin VB.CommandButton Command2 
      Caption         =   "帮助"
      Height          =   495
      Left            =   6120
      TabIndex        =   3
      ToolTipText     =   "有关软件使用的一些提示"
      Top             =   6360
      Width           =   1455
   End
   Begin VB.CommandButton Command1 
      Caption         =   "开始"
      Height          =   495
      Left            =   4560
      TabIndex        =   2
      ToolTipText     =   "开始打字练习"
      Top             =   6360
      Width           =   1335
   End
   Begin VB.PictureBox Picture1 
      BackColor       =   &H80000009&
      Height          =   4935
      Left            =   960
      ScaleHeight     =   325
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   605
      TabIndex        =   1
      Top             =   600
      Width           =   9135
      Begin VB.Timer Timer1 
         Enabled         =   0   'False
         Left            =   2640
         Top             =   4080
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         BackColor       =   &H80000009&
         Caption         =   "Label1"
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   18
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   360
         TabIndex        =   4
         Top             =   240
         Width           =   615
      End
   End
   Begin MSComctlLib.ProgressBar ProgressBar1 
      Height          =   495
      Left            =   1680
      TabIndex        =   0
      Top             =   6360
      Width           =   2655
      _ExtentX        =   4683
      _ExtentY        =   873
      _Version        =   393216
      Appearance      =   1
      Max             =   300
      Scrolling       =   1
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      Caption         =   "您的能力值是:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   120
      TabIndex        =   5
      Top             =   6370
      Width           =   1575
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim df, xls, jb As Integer
Sub init()
   Timer1.Interval = jb * 100
   df = 50
   ProgressBar1.Value = df
   Timer1.Enabled = True
   chuti
End Sub
Sub chuti()
   Dim seed As Integer
   Label1.Visible = False
   Randomize
   seed = Int(Rnd * 3)
   Select Case seed
   Case 0
     seed = 48 + Int(Rnd * 10)
   Case 1
     seed = 65 + Int(Rnd * 26)
   Case 2
     seed = 97 + Int(Rnd * 26)
   End Select
   
   Label1.Caption = Chr$(seed)
   Label1.Visible = True
   Label1.Left = Int(Rnd * Picture1.ScaleWidth)
   Label1.Top = 0
   Label1.ForeColor = QBColor(Rnd * 15)
   If Label1.ForeColor = vbWhite Then Label1.ForeColor = vbBlack
   xls = 0
   Picture1.SetFocus
End Sub

Private Sub Command1_Click()
init
End Sub

Private Sub Command2_Click()
MsgBox "1.为保证正确使用,请在<开始>前关闭中文输入法。" + Chr$(13) + "2.下落的字母有大小写之分,必须正确输入,才可得分。" + Chr$(13) + "3.练习范围:0-9,a-z,A-Z。", , "打字练习"

End Sub

Private Sub Form_Load()
jb = 6
End Sub

Private Sub Label1_Click()
Label1.Visible = False
End Sub

Private Sub Picture1_KeyPress(KeyAscii As Integer)
If Chr$(KeyAscii) = Label1.Caption Then
   df = df - xls + 8
   If df < 300 Then
      ProgressBar1.Value = df
   Else
      MsgBox "恭喜!恭喜!请您参加下一级练习!", , "打字练习"
      jb = jb - 1
      If jb = 0 Then jb = 6
      init
   End If
   chuti
End If
End Sub

Private Sub Timer1_Timer()
Dim ladd, sele As Integer
Randomize
Label1.Top = Label1.Top + Label1.Height
xls = xls + 1
ladd = -Label1.Width + Int(Rnd * 2 * Label1.Width)
Label1.Left = Label1.Left + ladd
If Label1.Left < 0 Then Label1.Left = 2 * Label1.Width
If Label1.Left > (Picture1.ScaleLeft + Picture1.ScaleWidth) Then Label1.Left = Picture1.ScaleLeft
If Label1.Top > (Picture1.ScaleTop + Picture1.ScaleHeight) Then
   chuti
   df = df - 10
End If
If df <= 0 Then
   sele = MsgBox("游戏结束,继续吗?", vbYesNo, "打字练习")
   If sele = vbYes Then
      init
   Else
      Label1.Visible = False
      Timer1.Enabled = False
      ProgressBar1.Value = 50
   End If
Else
   ProgressBar1.Value = df
End If

End Sub

⌨️ 快捷键说明

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