📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
Caption = "Form2"
ClientHeight = 4770
ClientLeft = 60
ClientTop = 450
ClientWidth = 4830
LinkTopic = "Form2"
ScaleHeight = 4770
ScaleWidth = 4830
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command4
Caption = "退出"
Height = 735
Left = 2640
TabIndex = 18
Top = 3120
Width = 855
End
Begin VB.CommandButton Command3
Caption = "清除"
Height = 735
Left = 1440
TabIndex = 17
Top = 3120
Width = 855
End
Begin VB.CommandButton Command2
Caption = "="
Height = 735
Left = 240
TabIndex = 16
Top = 3120
Width = 855
End
Begin VB.TextBox Text1
Height = 495
Left = 480
TabIndex = 15
Text = "Text1"
Top = 120
Width = 3855
End
Begin VB.CommandButton Command1
Caption = "/"
Height = 615
Index = 14
Left = 3720
TabIndex = 14
Top = 2160
Width = 735
End
Begin VB.CommandButton Command1
Caption = "*"
Height = 615
Index = 13
Left = 2880
TabIndex = 13
Top = 2160
Width = 735
End
Begin VB.CommandButton Command1
Caption = "-"
Height = 615
Index = 12
Left = 2040
TabIndex = 12
Top = 2160
Width = 735
End
Begin VB.CommandButton Command1
Caption = "+"
Height = 615
Index = 11
Left = 1200
TabIndex = 11
Top = 2160
Width = 735
End
Begin VB.CommandButton Command1
Caption = "."
Height = 615
Index = 10
Left = 360
TabIndex = 10
Top = 2160
Width = 735
End
Begin VB.CommandButton Command1
Caption = "9"
Height = 615
Index = 9
Left = 3720
TabIndex = 9
Top = 1440
Width = 735
End
Begin VB.CommandButton Command1
Caption = "8"
Height = 615
Index = 8
Left = 2880
TabIndex = 8
Top = 1440
Width = 735
End
Begin VB.CommandButton Command1
Caption = "7"
Height = 615
Index = 7
Left = 2040
TabIndex = 7
Top = 1440
Width = 735
End
Begin VB.CommandButton Command1
Caption = "6"
Height = 615
Index = 6
Left = 1200
TabIndex = 6
Top = 1440
Width = 735
End
Begin VB.CommandButton Command1
Caption = "5"
Height = 615
Index = 5
Left = 360
TabIndex = 5
Top = 1440
Width = 735
End
Begin VB.CommandButton Command1
Caption = "4"
Height = 615
Index = 4
Left = 3720
TabIndex = 4
Top = 720
Width = 735
End
Begin VB.CommandButton Command1
Caption = "3"
Height = 615
Index = 3
Left = 2880
TabIndex = 3
Top = 720
Width = 735
End
Begin VB.CommandButton Command1
Caption = "2"
Height = 615
Index = 2
Left = 2040
TabIndex = 2
Top = 720
Width = 735
End
Begin VB.CommandButton Command1
Caption = "1"
Height = 615
Index = 1
Left = 1200
TabIndex = 1
Top = 720
Width = 735
End
Begin VB.CommandButton Command1
Caption = "0"
Height = 615
Index = 0
Left = 360
TabIndex = 0
Top = 720
Width = 735
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim c As String, y(15) As String, a(15) As Double, t(15) As Double, i As Integer, b As Integer, res As Long
Private Sub Command1_Click(Index As Integer)
Text1.Text = Text1.Text + Command1(Index).Caption
c = Text1.Text
End Sub
Private Sub Command2_Click() '开始运算
i = 0
b = 0
Do While i >= 0
a(0) = Val(c)
If a(i) >= 1 Then b = b + Len(Str(a(i))) Else b = b + Len(Str(a(i))) + 1
y(i) = Mid(c, b, 1)
If y(i) = "" Then j = i: Exit Do Else i = i + 1: a(i) = Val(Right(c, Len(c) - b))
Loop
For i = 0 To j - 1
If y(i) = "*" Then
a(i) = a(i) * a(i + 1)
a(i + 1) = 0
y(i) = "+"
ElseIf y(i) = "/" Then
a(i) = a(i) / a(i + 1)
a(i + 1) = 0
y(i) = "+"
End If
Next
For i = 0 To j
t(i) = a(i)
Next
For i = 0 To j
Select Case y(i)
Case "+"
t(i + 1) = t(i) + t(i + 1)
Case "-"
t(i + 1) = t(i) - t(i + 1)
End Select
Next i
Text1.Text = Text1.Text + "=" + Str(t(j))
End Sub '结束运算
Private Sub Command3_Click()
Text1.Text = ""
End Sub
Private Sub Command4_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -