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

📄 form1.frm

📁 vb电子书籍
💻 FRM
字号:
   VERSION 5.00
   Begin VB.Form Form1
      Caption         =   "计算机考试"
      ClientHeight    =   3195
      ClientLeft      =   60
      ClientTop       =   345
      ClientWidth     =   4680
      LinkTopic       =   "Form1"
      MaxButton       =   0   'False
      ScaleHeight     =   3195
      ScaleWidth      =   4680
      StartUpPosition =   2  '屏幕中心
      Begin VB.PictureBox Picture1
         Height          =   1935
         Left            =   240
         ScaleHeight     =   1875
         ScaleWidth      =   4155
         TabIndex        =   3
         Top             =   960
         Width           =   4215
      End
      Begin VB.CommandButton Command1
         Caption         =   "计分"
         Height          =   375
         Left            =   3360
         TabIndex        =   2
         Top             =   360
         Width           =   975
      End
      Begin VB.TextBox Text1
         Height          =   375
         Left            =   2040
         TabIndex        =   1
         Top             =   360
         Width           =   1095
      End
      Begin VB.Label Label1
         BorderStyle     =   1  'Fixed Single
         Height          =   375
         Left            =   480
         TabIndex        =   0
         Top             =   360
         Width           =   1335
      End
   End
   Attribute VB_Name = "Form1"
   Attribute VB_GlobalNameSpace = False
   Attribute VB_Creatable = False
   Attribute VB_PredeclaredId = True
   Attribute VB_Exposed = False
'CODE Manger By BcodeXRose
Option Explicit
Dim result!, nok%, nerror%

'******************************************************************
'************** 过程名称:Command1_Click
'************** 参数: 无
'******************************************************************
Private Sub Command1_Click()
  Label1 = ""
  Picture1.Print "-----------------------------------"
  Picture1.Print "一共计算" & (nok + nerror) & "道题";
  Picture1.Print "得分" & Int(nok / (nok + nerror) * 100)
  
End Sub
  
'******************************************************************
'************** 过程名称:Form_Load
'************** 参数: 无
'******************************************************************
Private Sub Form_Load()
  Dim num1%, num2%, nop%, op$
  Randomize
  num1 = Int(10 * Rnd + 1)
  num2 = Int(10 * Rnd + 1)
  nop = Int(4 * Rnd + 1)
  Select Case nop
    Case 1
      op = "+": result = num1 + num2
    Case 2
      op = "-": result = num1 - num2
    Case 3
      op = "*": result = num1 * num2
    Case 4
      op = "/": result = num1 / num2
  End Select
  
  Label1 = num1 & op & num2 & "="
  
End Sub
  
'******************************************************************
'************** 过程名称:Text1_KeyPress
'************** 参数:KeyAscii 为Integer型
'******************************************************************
Private Sub Text1_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then
    If Val(Text1) = result Then
      Picture1.Print Label1; Text1; Tab(10); "-/"
      nok = nok + 1
    Else
      Picture1.Print Label1; Text1; Tab(10); "*"
      nerror = nerror + 1
    End If
    Text1 = ""
    Text1.SetFocus
    Form_Load
  End If
End Sub
  

⌨️ 快捷键说明

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