📄 form7.frm
字号:
VERSION 5.00
Begin VB.Form Form7
Caption = "Form7"
ClientHeight = 5295
ClientLeft = 60
ClientTop = 465
ClientWidth = 8070
LinkTopic = "Form7"
ScaleHeight = 5295
ScaleWidth = 8070
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "操作数"
Height = 975
Left = 480
TabIndex = 7
Top = 480
Width = 7215
Begin VB.TextBox Text1
Alignment = 1 'Right Justify
Height = 495
Left = 120
TabIndex = 9
Top = 360
Width = 1455
End
Begin VB.TextBox Text2
Alignment = 1 'Right Justify
Height = 495
Left = 2520
TabIndex = 8
Top = 360
Width = 1935
End
End
Begin VB.Frame Frame2
Caption = "运算符"
Height = 1095
Left = 480
TabIndex = 2
Top = 1800
Width = 7215
Begin VB.OptionButton Option1
Caption = "加"
CausesValidation= 0 'False
Height = 495
Left = 120
TabIndex = 6
Top = 480
Value = -1 'True
Width = 855
End
Begin VB.OptionButton Option2
Caption = "减"
Height = 495
Left = 1680
TabIndex = 5
Top = 480
Width = 1215
End
Begin VB.OptionButton Option3
Caption = "乘"
Height = 375
Left = 3360
TabIndex = 4
Top = 480
Width = 975
End
Begin VB.OptionButton Option4
Caption = "除"
Height = 495
Left = 4920
TabIndex = 3
Top = 360
Width = 1215
End
End
Begin VB.Frame Frame3
Caption = "运算结果"
Height = 1215
Left = 600
TabIndex = 0
Top = 3240
Width = 6975
Begin VB.TextBox Text3
Alignment = 1 'Right Justify
Height = 615
Left = 1560
TabIndex = 1
Top = 480
Width = 2895
End
End
End
Attribute VB_Name = "Form7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Option1_Click()
Option1.Value = True
Option2.Value = False
Option3.Value = False
Option4.Value = False
Call js
End Sub
Private Sub Option2_Click()
Option1.Value = False
Option2.Value = True
Option3.Value = False
Option4.Value = False
Call js
End Sub
Private Sub Option3_Click()
Option1.Value = False
Option2.Value = False
Option3.Value = True
Option4.Value = False
Call js
End Sub
Private Sub Option4_Click()
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = True
Call js
End Sub
Private Sub Text1_Change()
Call js
End Sub
Private Sub Text2_Change()
Call js
End Sub
Public Sub js()
If Option1 Then
Text3 = Val(Text1) + Val(Text2)
ElseIf Option2 Then
Text3 = Val(Text1) - Val(Text2)
ElseIf Option3 Then
Text3 = Val(Text1) * Val(Text2)
ElseIf Val(Text2) = 0 Then
Text3 = "0做除数,溢出"
Else
Text3 = Val(Text1) / Val(Text2)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -