5.4.frm

来自「VB6.0应用例题」· FRM 代码 · 共 204 行

FRM
204
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "简易计算器"
   ClientHeight    =   2880
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6090
   LinkTopic       =   "Form1"
   ScaleHeight     =   2880
   ScaleWidth      =   6090
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "计算"
      Height          =   375
      Left            =   720
      TabIndex        =   15
      Top             =   1560
      Width           =   1335
   End
   Begin VB.Frame Frame2 
      Height          =   735
      Left            =   3120
      TabIndex        =   12
      Top             =   1800
      Width           =   2775
      Begin VB.CheckBox Check2 
         Caption         =   "粗体显示"
         Height          =   375
         Left            =   1560
         TabIndex        =   14
         Top             =   240
         Width           =   1095
      End
      Begin VB.CheckBox Check1 
         Caption         =   "斜体显示"
         Height          =   375
         Left            =   240
         TabIndex        =   13
         Top             =   240
         Width           =   1455
      End
   End
   Begin VB.CommandButton Command2 
      Caption         =   "清除(&D)"
      Height          =   375
      Left            =   720
      TabIndex        =   11
      Top             =   2160
      Width           =   1335
   End
   Begin VB.Frame Frame1 
      Height          =   735
      Left            =   3120
      TabIndex        =   6
      Top             =   960
      Width           =   2775
      Begin VB.OptionButton Option4 
         Caption         =   "除"
         Height          =   345
         Left            =   2040
         TabIndex        =   10
         Top             =   240
         Width           =   495
      End
      Begin VB.OptionButton Option3 
         Caption         =   "乘"
         Height          =   345
         Left            =   1440
         TabIndex        =   9
         Top             =   240
         Width           =   495
      End
      Begin VB.OptionButton Option2 
         Caption         =   "减"
         Height          =   345
         Left            =   840
         TabIndex        =   8
         Top             =   240
         Width           =   495
      End
      Begin VB.OptionButton Option1 
         Caption         =   "加"
         Height          =   345
         Left            =   240
         TabIndex        =   7
         Top             =   240
         Width           =   495
      End
   End
   Begin VB.TextBox Text3 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3360
      Locked          =   -1  'True
      TabIndex        =   2
      Top             =   240
      Width           =   2295
   End
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   960
      TabIndex        =   1
      Top             =   960
      Width           =   1335
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   960
      TabIndex        =   0
      Top             =   240
      Width           =   1335
   End
   Begin VB.Label Label3 
      Caption         =   "结  果:"
      Height          =   375
      Left            =   2640
      TabIndex        =   5
      Top             =   360
      Width           =   975
   End
   Begin VB.Label Label2 
      Caption         =   "操作数2:"
      Height          =   375
      Left            =   120
      TabIndex        =   4
      Top             =   1080
      Width           =   1095
   End
   Begin VB.Label Label1 
      Caption         =   "操作数1:"
      Height          =   375
      Left            =   120
      TabIndex        =   3
      Top             =   360
      Width           =   1335
   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()  '计算
  a = Val(Text1.Text): b = Val(Text2.Text)
  If Option1 = True Then
    Text3.Text = a + b
  End If
  If Option2 = True Then
    Text3.Text = a - b
  End If
  If Option3 = True Then
    Text3.Text = a * b
  End If
  If Option4 = True Then
    Text3.Text = a / b
  End If
End Sub
Private Sub Check1_Click()
  If Check1.Value = 1 Then
    Text3.FontItalic = True     '设置斜体
  Else
    Text3.FontItalic = False
  End If
End Sub
Private Sub Check2_Click()
  If Check2.Value = 1 Then
    Text3.FontBold = True       '设置粗体
  Else
    Text3.FontBold = False
  End If
End Sub
Private Sub Command2_Click()    '清除
  Text1.Text = ""
  Text2.Text = ""
  Text3.Text = ""
End Sub

⌨️ 快捷键说明

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