📄 5.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
Height = 495
Left = 1800
TabIndex = 10
Text = "Text1"
Top = 1080
Width = 2175
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 375
Left = 2520
TabIndex = 8
Top = 2640
Width = 975
End
Begin VB.CommandButton Command1
Caption = "出题"
Height = 375
Left = 360
TabIndex = 7
Top = 2640
Width = 855
End
Begin VB.OptionButton Option1
Caption = "除法"
Height = 375
Index = 3
Left = 3720
TabIndex = 6
Top = 2160
Width = 735
End
Begin VB.OptionButton Option1
Caption = "乘法"
Height = 375
Index = 2
Left = 2880
TabIndex = 5
Top = 2160
Width = 735
End
Begin VB.OptionButton Option1
Caption = "减法"
Height = 375
Index = 1
Left = 1920
TabIndex = 4
Top = 2160
Width = 855
End
Begin VB.OptionButton Option1
Caption = "加法"
Height = 375
Index = 0
Left = 1200
TabIndex = 3
Top = 2160
Width = 735
End
Begin VB.Label Label4
Caption = "输入计算方法"
Height = 495
Left = 120
TabIndex = 9
Top = 1080
Width = 1335
End
Begin VB.Label Label3
Caption = "运算方法"
Height = 375
Left = 0
TabIndex = 2
Top = 2040
Width = 855
End
Begin VB.Label Label2
Caption = "Label2"
Height = 735
Left = 2160
TabIndex = 1
Top = 120
Width = 1695
End
Begin VB.Label Label1
Caption = "Label1"
Height = 615
Left = 240
TabIndex = 0
Top = 240
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim XZYS As Integer
Dim CFJG As Integer
Private Sub Command1_Click()
Dim x, y As Integer
Text1.Text = " "
Text1.SetFocus
Label3.Caption = " "
Randomize
labe1: x = Int(Rnd * 99 + 1)
y = Int(Rnd * 99 + 1)
If XZYS = 1 And x < y Then GoTo labe1
If XZYS = 3 And Int(x / y) * y <> x Then GoTo labe1
Select Case XZYS
Case 0
Label1.Caption = "被加数: " & x
Label2.Caption = "加数: " & y
CFJG = x + y
Case 1
Label1.Caption = "被减数: " & x
Label2.Caption = "减数: " & y
CFJG = x - y
Case 2
Label1.Caption = "被乘数: " & x
Label2.Caption = "乘数: " & y
CFJG = x * y
Case 3
Label1.Caption = "被除数: " & x
Label2.Caption = "除数: " & y
CFJG = x / y
End Select
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
XZYS = 0
End Sub
Private Sub Option1_Click(Index As Integer)
Select Case Index
Case 0
Label1.Caption = "被加数: "
Label2.Caption = "加数: "
CFJG = x + y
Case 1
Label1.Caption = "被减数: "
Label2.Caption = "减数: "
CFJG = x - y
Case 2
Label1.Caption = "被乘数: "
Label2.Caption = "乘数: "
CFJG = x * y
Case 3
Label1.Caption = "被除数: "
Label2.Caption = "除数: "
CFJG = x / y
End Select
XZYS = Index
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim z1 As Integer
If KeyAscii = 13 Then
z1 = Val(Text1.Text)
If z1 = CFJG Then
Label3.Caption = "计算结果正确!"
Else
Text1.Text = " "
Beep
Label3.Caption = "计算结果错误!请重新计算。"
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -