⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 计算器.frm

📁 VB源码,是初学者的福因.让你很快掌握VB编程
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "计算器"
   ClientHeight    =   2715
   ClientLeft      =   60
   ClientTop       =   390
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   2715
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   3120
      TabIndex        =   17
      Top             =   120
      Width           =   975
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   1560
      TabIndex        =   16
      Top             =   120
      Width           =   855
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   240
      TabIndex        =   15
      Top             =   120
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "0"
      Height          =   375
      Index           =   9
      Left            =   3480
      TabIndex        =   14
      Top             =   1440
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "9"
      Height          =   375
      Index           =   8
      Left            =   2760
      TabIndex        =   13
      Top             =   1440
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "8"
      Height          =   375
      Index           =   7
      Left            =   2040
      TabIndex        =   12
      Top             =   1440
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "7"
      Height          =   375
      Index           =   6
      Left            =   1320
      TabIndex        =   11
      Top             =   1440
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "6"
      Height          =   375
      Index           =   5
      Left            =   600
      TabIndex        =   10
      Top             =   1440
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "5"
      Height          =   375
      Index           =   4
      Left            =   3480
      TabIndex        =   9
      Top             =   840
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "4"
      Height          =   375
      Index           =   3
      Left            =   2760
      TabIndex        =   8
      Top             =   840
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "3"
      Height          =   375
      Index           =   2
      Left            =   2040
      TabIndex        =   7
      Top             =   840
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "2"
      Height          =   375
      Index           =   1
      Left            =   1320
      TabIndex        =   6
      Top             =   840
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "1"
      Height          =   375
      Index           =   0
      Left            =   600
      TabIndex        =   5
      Top             =   840
      Width           =   375
   End
   Begin VB.CommandButton Command15 
      Caption         =   "="
      Height          =   375
      Left            =   3480
      TabIndex        =   4
      Top             =   2040
      Width           =   375
   End
   Begin VB.CommandButton Command2 
      Caption         =   "/"
      Height          =   375
      Index           =   3
      Left            =   2760
      TabIndex        =   3
      Top             =   2040
      Width           =   375
   End
   Begin VB.CommandButton Command2 
      Caption         =   "*"
      Height          =   375
      Index           =   2
      Left            =   2040
      TabIndex        =   2
      Top             =   2040
      Width           =   375
   End
   Begin VB.CommandButton Command2 
      Caption         =   "-"
      Height          =   375
      Index           =   1
      Left            =   1320
      TabIndex        =   1
      Top             =   2040
      Width           =   375
   End
   Begin VB.CommandButton Command2 
      Caption         =   "+"
      Height          =   375
      Index           =   0
      Left            =   600
      TabIndex        =   0
      Top             =   2040
      Width           =   375
   End
   Begin VB.Label Label2 
      Caption         =   "="
      Height          =   375
      Left            =   2640
      TabIndex        =   19
      Top             =   240
      Width           =   135
   End
   Begin VB.Label Label1 
      Height          =   375
      Left            =   1200
      TabIndex        =   18
      Top             =   240
      Width           =   495
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Temp As Double
Dim d1, d2 As Integer
Dim t As Integer
Dim p As Integer
Private Sub Command1_Click(Index As Integer)
    If p = 0 Then
      Text1.Text = Text1.Text & Command1(Index).Caption
      d1 = Val(Text1.Text)
    ElseIf p = 1 Then
      Text2.Text = Text2.Text & Command1(Index).Caption
      d2 = Val(Text2.Text)
   End If
End Sub
Private Sub Command15_Click()
  p = 0
  Select Case t
  Case 1
      Temp = d1 + d2
  Case 2
      Temp = d1 - d2
  Case 3
      Temp = d1 * d2
 Case 4
      Temp = d1 / d2
 End Select
 Text3.Text = Temp
End Sub
Private Sub Command2_Click(Index As Integer)
   p = 1
   t = Index + 1
   Label1.Caption = Command2(Index).Caption
End Sub

Private Sub Form_Load()

End Sub

⌨️ 快捷键说明

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