wangtao.frm

来自「上传的包含两个文件」· FRM 代码 · 共 227 行

FRM
227
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3930
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4515
   LinkTopic       =   "Form1"
   ScaleHeight     =   3930
   ScaleWidth      =   4515
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command4 
      Caption         =   "清空"
      Height          =   495
      Left            =   1080
      TabIndex        =   16
      Top             =   3000
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   600
      TabIndex        =   15
      Text            =   "Text1"
      Top             =   120
      Width           =   2895
   End
   Begin VB.CommandButton Command3 
      Caption         =   "="
      Height          =   495
      Left            =   2520
      TabIndex        =   14
      Top             =   2040
      Width           =   735
   End
   Begin VB.CommandButton Command2 
      Caption         =   "/"
      Height          =   375
      Index           =   3
      Left            =   1560
      TabIndex        =   13
      Top             =   2400
      Width           =   615
   End
   Begin VB.CommandButton Command2 
      Caption         =   "*"
      Height          =   375
      Index           =   2
      Left            =   840
      TabIndex        =   12
      Top             =   2400
      Width           =   615
   End
   Begin VB.CommandButton Command2 
      Caption         =   "-"
      Height          =   375
      Index           =   1
      Left            =   1560
      TabIndex        =   11
      Top             =   1800
      Width           =   615
   End
   Begin VB.CommandButton Command2 
      Caption         =   "+"
      Height          =   375
      Index           =   0
      Left            =   840
      TabIndex        =   10
      Top             =   1800
      Width           =   615
   End
   Begin VB.CommandButton Command1 
      Caption         =   "9"
      Height          =   375
      Index           =   10
      Left            =   2760
      TabIndex        =   9
      Top             =   1320
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "8"
      Height          =   375
      Index           =   8
      Left            =   2280
      TabIndex        =   8
      Top             =   1320
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "7"
      Height          =   375
      Index           =   7
      Left            =   1800
      TabIndex        =   7
      Top             =   1320
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "6"
      Height          =   375
      Index           =   6
      Left            =   1320
      TabIndex        =   6
      Top             =   1320
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "5"
      Height          =   375
      Index           =   5
      Left            =   840
      TabIndex        =   5
      Top             =   1320
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "4"
      Height          =   375
      Index           =   4
      Left            =   2760
      TabIndex        =   4
      Top             =   840
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "3"
      Height          =   375
      Index           =   3
      Left            =   2280
      TabIndex        =   3
      Top             =   840
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "2"
      Height          =   375
      Index           =   2
      Left            =   1800
      TabIndex        =   2
      Top             =   840
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "1"
      Height          =   375
      Index           =   1
      Left            =   1320
      TabIndex        =   1
      Top             =   840
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "0"
      Height          =   375
      Index           =   0
      Left            =   840
      TabIndex        =   0
      Top             =   840
      Width           =   375
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a As String
Dim i As Integer, b(12) As Integer, y(15) As String
Private Sub Form_Load()
i = 0
End Sub

Private Sub Command1_Click(Index As Integer)
Text1.Text = Text1.Text + Command1(Index).Caption
a = Text1.Text
End Sub

Private Sub Command2_Click(Index As Integer)
Select Case Index
    Case 0
    y(i) = "+"
    b(i) = Val(a)
   Text1.Text = ""
   i = i + 1
    
   Case 1
       y(i) = "-"
       b(i) = Val(a)
        Text1.Text = ""
   i = i + 1
Case 2
    y(i) = "*"
    b(i) = Val(a)
     Text1.Text = ""
   i = i + 1
Case 3
    y(i) = "/"
b(i) = Val(a)
 Text1.Text = ""
   i = i + 1
End Select
End Sub

Private Sub Command3_Click()
j = i
b(j) = Val(a)
For i = 1 To j
Select Case y(i - 1)
Case "+"
b(i) = b(i - 1) + b(i)
Case "-"
b(i) = b(i - 1) - b(i)
Case "*"
b(i) = b(i - 1) * b(i)
Case "/"
b(i) = b(i - 1) / b(i)
End Select
Next
Text1.Text = b(j)
End Sub

Private Sub Command4_Click()
Text1.Text = ""
End Sub

⌨️ 快捷键说明

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