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

📄 form1.frm

📁 本文件包含200个visual baisc实例
💻 FRM
字号:
VERSION 5.00
Begin VB.Form form1 
   BackColor       =   &H00FFC0C0&
   Caption         =   "可记忆计算过程的计算器"
   ClientHeight    =   5100
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7335
   Icon            =   "form1.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   5100
   ScaleWidth      =   7335
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton Command4 
      BackColor       =   &H00C0E0FF&
      Caption         =   "-"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   5505
      Style           =   1  'Graphical
      TabIndex        =   9
      Top             =   570
      Width           =   1410
   End
   Begin VB.CommandButton Command3 
      BackColor       =   &H00C0E0FF&
      Caption         =   "+"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3975
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   555
      Width           =   1410
   End
   Begin VB.TextBox Text3 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFC0C0&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   585
      Left            =   1965
      TabIndex        =   6
      Top             =   1215
      Width           =   4980
   End
   Begin VB.TextBox Text2 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Height          =   2160
      Left            =   240
      MultiLine       =   -1  'True
      TabIndex        =   5
      Top             =   2700
      Width           =   6825
   End
   Begin VB.CommandButton Command2 
      BackColor       =   &H00C0E0FF&
      Caption         =   "退出"
      Height          =   375
      Left            =   5550
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   2055
      Width           =   1410
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00C0E0FF&
      Caption         =   "清零"
      Height          =   390
      Left            =   3975
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   2055
      Width           =   1425
   End
   Begin VB.TextBox Text1 
      Alignment       =   1  'Right Justify
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2010
      TabIndex        =   1
      Top             =   570
      Width           =   1740
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "显示屏(总计)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   555
      Left            =   1035
      TabIndex        =   7
      Top             =   1275
      Width           =   810
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "输入数字:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   960
      TabIndex        =   4
      Top             =   615
      Width           =   1185
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "提示栏:(连加过程)"
      Height          =   270
      Left            =   180
      TabIndex        =   0
      Top             =   2370
      Width           =   1965
   End
   Begin VB.Shape Shape1 
      Height          =   2355
      Left            =   135
      Top             =   2625
      Width           =   7065
   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()      '清零
  Text3.Text = ""
  Text1.Text = ""
  Text2.Text = ""
  Text1.SetFocus
End Sub

Private Sub Command3_Click()   '计算器加计算
  If Val(Text1.Text) > 0 Then
      Text3.Text = Val(Text1.Text) + Val(Text3.Text)
      Text3.Text = Format(Text3.Text, "0.00")
      Text2.Text = Text2.Text & "+" & Val(Text1.Text)
      Text1.Text = ""
   Text1.SetFocus
   End If
End Sub

Private Sub Command4_Click()    '计算器减计算
If Val(Text1.Text) > 0 Then
      Text3.Text = -Val(Text1.Text) + Val(Text3.Text)
      Text3.Text = Format(Text3.Text, "0.00")
      Text2.Text = Text2.Text & "-" & Val(Text1.Text)
      Text1.Text = ""
   Text1.SetFocus
 End If
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)  '计算器计算
  If Val(Text1.Text) > 0 Then     '输入数据有效
  If Text2.Text = "" Then
      If KeyCode = vbKeyReturn Then         '计算器加计算
         Text3.Text = Val(Text1.Text) + Val(Text3.Text)
         Text3.Text = Format(Text3.Text, "0.00")
         Text2.Text = Text1.Text
         Text1.Text = ""
      End If
       If KeyCode = vbKeySpace Then         '计算器减计算
         Text3.Text = -Val(Text1.Text) + Val(Text3.Text)
         Text3.Text = Format(Text3.Text, "0.00")
         Text2.Text = Text2.Text & "-" & Val(Text1.Text)
         Text1.Text = ""
      End If
  Else
        If KeyCode = vbKeyReturn Then        '计算器加计算
         Text3.Text = Val(Text1.Text) + Val(Text3.Text)
         Text3.Text = Format(Text3.Text, "0.00")
         Text2.Text = Text2.Text & "+" & Val(Text1.Text)
         Text1.Text = ""
      End If
       If KeyCode = vbKeySpace Then         '计算器减计算
         Text3.Text = -Val(Text1.Text) + Val(Text3.Text)
         Text3.Text = Format(Text3.Text, "0.00")
         Text2.Text = Text2.Text & "-" & Val(Text1.Text)
         Text1.Text = ""
      End If
    End If
   End If
   Text1.SetFocus
End Sub

Private Sub Command2_Click()
  End
End Sub

⌨️ 快捷键说明

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