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

📄 计算器.frm

📁 Visual Basic课程举例1 有很好的例题
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4320
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7395
   LinkTopic       =   "Form1"
   ScaleHeight     =   4320
   ScaleWidth      =   7395
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "清屏"
      Height          =   495
      Left            =   3240
      TabIndex        =   9
      Top             =   3000
      Width           =   3495
   End
   Begin VB.CommandButton Command1 
      Caption         =   "计算"
      Height          =   495
      Left            =   120
      TabIndex        =   8
      Top             =   3000
      Width           =   2775
   End
   Begin VB.TextBox Text4 
      Height          =   975
      Left            =   5280
      TabIndex        =   7
      Top             =   1320
      Width           =   1815
   End
   Begin VB.TextBox Text3 
      Height          =   975
      Left            =   3360
      TabIndex        =   6
      Top             =   1320
      Width           =   1575
   End
   Begin VB.TextBox Text2 
      Height          =   975
      Left            =   1680
      TabIndex        =   5
      Top             =   1320
      Width           =   1335
   End
   Begin VB.TextBox Text1 
      Height          =   975
      Left            =   120
      TabIndex        =   4
      Top             =   1320
      Width           =   1335
   End
   Begin VB.Label Label4 
      Alignment       =   2  'Center
      Caption         =   "结果"
      Height          =   615
      Left            =   5400
      TabIndex        =   3
      Top             =   360
      Width           =   1575
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      Caption         =   "输入数2"
      Height          =   495
      Left            =   3000
      TabIndex        =   2
      Top             =   480
      Width           =   1815
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      Caption         =   "运算符1"
      Height          =   495
      Left            =   1440
      TabIndex        =   1
      Top             =   480
      Width           =   1215
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Caption         =   "输入数1"
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Top             =   480
      Width           =   975
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim a As Double, b As Double
a = Val(Text1.Text)
b = Val(Text3.Text)
If Text2.Text = "+" Then
Text4.Text = a + b
ElseIf Text2.Text = "-" Then
Text4.Text = a - b
ElseIf Text2.Text = "*" Then
Text4.Text = a * b
ElseIf Text2.Text = "/" Then
Text4.Text = a / b
End If






End Sub

Private Sub Command2_Click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
End Sub

⌨️ 快捷键说明

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