📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 7860
ClientLeft = 60
ClientTop = 450
ClientWidth = 11190
LinkTopic = "Form1"
ScaleHeight = 7860
ScaleWidth = 11190
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
Alignment = 1 'Right Justify
BeginProperty Font
Name = "宋体"
Size = 42
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 3480
TabIndex = 19
Top = 1320
Width = 5895
End
Begin VB.CommandButton Command1
Caption = "+"
Height = 615
Index = 11
Left = 6720
TabIndex = 18
Top = 3600
Width = 615
End
Begin VB.CommandButton Command1
Caption = "-"
Height = 615
Index = 12
Left = 8160
TabIndex = 17
Top = 3480
Width = 615
End
Begin VB.CommandButton Command1
Caption = "*"
Height = 615
Index = 13
Left = 6840
TabIndex = 16
Top = 4680
Width = 615
End
Begin VB.CommandButton Command1
Caption = "/"
Height = 615
Index = 14
Left = 8160
TabIndex = 15
Top = 4800
Width = 615
End
Begin VB.CommandButton Command1
Caption = "Mod"
Height = 615
Index = 15
Left = 6840
TabIndex = 14
Top = 5880
Width = 615
End
Begin VB.CommandButton Command1
Caption = "C"
Height = 1215
Index = 16
Left = 9120
TabIndex = 13
Top = 3600
Width = 975
End
Begin VB.CommandButton Command1
Caption = "="
Height = 615
Index = 17
Left = 8280
TabIndex = 12
Top = 5880
Width = 615
End
Begin VB.CommandButton Command1
Caption = "EXIT"
Height = 1095
Index = 18
Left = 9240
TabIndex = 11
Top = 5760
Width = 975
End
Begin VB.CommandButton Command1
Caption = "0"
Height = 615
Index = 0
Left = 1560
TabIndex = 10
Top = 6240
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "1"
Height = 615
Index = 1
Left = 1560
TabIndex = 9
Top = 3360
Width = 615
End
Begin VB.CommandButton Command1
Caption = "2"
Height = 615
Index = 2
Left = 2520
TabIndex = 8
Top = 3360
Width = 615
End
Begin VB.CommandButton Command1
Caption = "3"
Height = 615
Index = 3
Left = 3480
TabIndex = 7
Top = 3360
Width = 615
End
Begin VB.CommandButton Command1
Caption = "4"
Height = 615
Index = 4
Left = 1560
TabIndex = 6
Top = 4320
Width = 615
End
Begin VB.CommandButton Command1
Caption = "5"
Height = 615
Index = 5
Left = 2520
TabIndex = 5
Top = 4320
Width = 615
End
Begin VB.CommandButton Command1
Caption = "6"
Height = 615
Index = 6
Left = 3480
TabIndex = 4
Top = 4320
Width = 615
End
Begin VB.CommandButton Command1
Caption = "7"
Height = 615
Index = 7
Left = 1560
TabIndex = 3
Top = 5280
Width = 615
End
Begin VB.CommandButton Command1
Caption = "8"
Height = 615
Index = 8
Left = 2520
TabIndex = 2
Top = 5280
Width = 615
End
Begin VB.CommandButton Command1
Caption = "9"
Height = 615
Index = 9
Left = 3480
TabIndex = 1
Top = 5280
Width = 615
End
Begin VB.CommandButton Command1
Caption = "."
Height = 615
Index = 10
Left = 3480
TabIndex = 0
Top = 6240
Width = 615
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim num1, num2 As Double
Dim sum As Double
Dim act, m As Integer
Private Sub Form_Load()
num1 = 0
m = 0
num2 = 0
sum = 0
End Sub
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0 To 9
If m = 1 Then
Text1.Text = ""
m = 0
End If
If Text1.Text = "" Then
Text1.Text = CStr(Index)
Else
Text1.Text = Text1.Text + CStr(Index)
End If
Case 10
If Text1.Text = "" Then
Text1.Text = "."
Else
Text1.Text = Text1.Text + "."
End If
Case 11
num1 = CDbl(Text1.Text)
Text1.Text = ""
act = 1
Case 12
num1 = CDbl(Text1.Text)
Text1.Text = ""
act = 2
Case 13
num1 = CDbl(Text1.Text)
Text1.Text = ""
act = 3
Case 14
num1 = CDbl(Text1.Text)
Text1.Text = ""
act = 4
Case 15
num1 = CDbl(Text1.Text)
Text1.Text = ""
act = 5
Case 16
num1 = 0
num2 = 0
sum = 0
Text1.Text = ""
Case 17
num2 = CDbl(Text1.Text)
m = 1
Select Case act
Case 1
sum = num1 + num2
Case 2
sum = num1 - num2
Case 3
sum = num1 * num2
Case 4
sum = num1 / num2
Case 5
sum = num1 Mod num2
End Select
sum = Round(sum, 4)
Text1.Text = ""
Text1.Text = CStr(sum)
Case 18
End
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -