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

📄 form1.frm

📁 计算器和记事本的VB源码,计算器和记事本
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "计算器"
   ClientHeight    =   4800
   ClientLeft      =   4995
   ClientTop       =   3555
   ClientWidth     =   4515
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   4800
   ScaleWidth      =   4515
   Begin VB.TextBox txtsecond 
      Height          =   375
      Left            =   1080
      TabIndex        =   23
      Top             =   4440
      Visible         =   0   'False
      Width           =   615
   End
   Begin VB.TextBox txtlabel 
      Height          =   375
      Left            =   600
      TabIndex        =   22
      Top             =   4440
      Visible         =   0   'False
      Width           =   495
   End
   Begin VB.TextBox txtfirst 
      Height          =   375
      Left            =   0
      TabIndex        =   21
      Top             =   4440
      Visible         =   0   'False
      Width           =   615
   End
   Begin VB.CommandButton Command18 
      Caption         =   "退出"
      Height          =   375
      Left            =   2280
      TabIndex        =   20
      Top             =   3720
      Width           =   1815
   End
   Begin VB.Frame Frame2 
      Caption         =   "功能区"
      Height          =   1815
      Left            =   120
      TabIndex        =   2
      Top             =   2520
      Width           =   4335
      Begin VB.CommandButton Command17 
         Caption         =   "C"
         Height          =   375
         Left            =   360
         TabIndex        =   19
         Top             =   1200
         Width           =   1815
      End
      Begin VB.CommandButton Command16 
         Caption         =   "="
         Height          =   855
         Left            =   3240
         TabIndex        =   18
         Top             =   360
         Width           =   735
      End
      Begin VB.CommandButton Command15 
         Caption         =   "÷"
         Height          =   855
         Left            =   2520
         TabIndex        =   17
         Top             =   360
         Width           =   735
      End
      Begin VB.CommandButton Command14 
         Caption         =   "×"
         Height          =   855
         Left            =   1800
         TabIndex        =   16
         Top             =   360
         Width           =   735
      End
      Begin VB.CommandButton Command13 
         Caption         =   "—"
         Height          =   855
         Left            =   1080
         TabIndex        =   15
         Top             =   360
         Width           =   735
      End
      Begin VB.CommandButton Command12 
         Caption         =   "+"
         Height          =   855
         Left            =   360
         TabIndex        =   14
         Top             =   360
         Width           =   735
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "数字区"
      Height          =   1575
      Left            =   120
      TabIndex        =   1
      Top             =   840
      Width           =   4335
      Begin VB.CommandButton Command11 
         Caption         =   "+/-"
         Height          =   1215
         Left            =   3720
         TabIndex        =   13
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton Command10 
         Caption         =   "0"
         Height          =   615
         Left            =   3000
         TabIndex        =   12
         Top             =   840
         Width           =   735
      End
      Begin VB.CommandButton Command9 
         Caption         =   "9"
         Height          =   615
         Left            =   2280
         TabIndex        =   11
         Top             =   840
         Width           =   735
      End
      Begin VB.CommandButton Command8 
         Caption         =   "8"
         Height          =   615
         Left            =   1560
         TabIndex        =   10
         Top             =   840
         Width           =   735
      End
      Begin VB.CommandButton Command7 
         Caption         =   "7"
         Height          =   615
         Left            =   840
         TabIndex        =   9
         Top             =   840
         Width           =   735
      End
      Begin VB.CommandButton Command6 
         Caption         =   "6"
         Height          =   615
         Left            =   120
         TabIndex        =   8
         Top             =   840
         Width           =   735
      End
      Begin VB.CommandButton Command5 
         Caption         =   "5"
         Height          =   615
         Left            =   3000
         TabIndex        =   7
         Top             =   240
         Width           =   735
      End
      Begin VB.CommandButton Command4 
         Caption         =   "4"
         Height          =   615
         Left            =   2280
         TabIndex        =   6
         Top             =   240
         Width           =   735
      End
      Begin VB.CommandButton Command3 
         Caption         =   "3"
         Height          =   615
         Left            =   1560
         TabIndex        =   5
         Top             =   240
         Width           =   735
      End
      Begin VB.CommandButton Command2 
         Caption         =   "2"
         Height          =   615
         Left            =   840
         TabIndex        =   4
         Top             =   240
         Width           =   735
      End
      Begin VB.CommandButton Command1 
         Caption         =   "1"
         Height          =   615
         Left            =   120
         TabIndex        =   3
         Top             =   240
         Width           =   735
      End
   End
   Begin VB.TextBox txtresult 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFC0&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   24
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   0
      TabIndex        =   0
      Top             =   120
      Width           =   4455
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub abort_Click()

frmAbout.Show 1

End Sub

Private Sub Command1_Click()

If txtlabel.Text = "" Then

   txtfirst.Text = txtfirst.Text + "1"
                      
                      Else
                      
   txtsecond.Text = txtsecond.Text + "1"
   
End If


End Sub


Private Sub Command10_Click()

If txtlabel.Text = "" Then

   txtfirst.Text = txtfirst.Text + "0"
                      
                      Else
                      
   txtsecond.Text = txtsecond.Text + "0"
   
End If

 
End Sub

Private Sub Command11_Click()

If txtlabel.Text = "" Then

   txtfirst.Text = -1 * (txtfirst.Text)
                      
                      Else
                      
   txtsecond.Text = -1 * (txtsecond.Text)
   
End If

End Sub

Private Sub Command12_Click()

txtlabel.Text = "加"

End Sub

Private Sub Command13_Click()

txtlabel.Text = "减"

End Sub

Private Sub Command14_Click()

txtlabel.Text = "乘"

End Sub

Private Sub Command15_Click()

txtlabel.Text = "除"

End Sub

Private Sub Command16_Click()

Dim myresult As Double
Select Case txtlabel.Text
       Case "加"
       myresult = Val(txtfirst.Text) + Val(txtsecond.Text)
       
       Case "减"
       myresult = Val(txtfirst.Text) - Val(txtsecond.Text)
       
       Case "乘"
       myresult = Val(txtfirst.Text) * Val(txtsecond.Text)
       
       Case "除"
       myresult = Val(txtfirst.Text) / Val(txtsecond.Text)
End Select

txtlabel.Text = ""
txtsecond.Text = ""
txtresult.Text = myresult
txtfirst.Text = txtresult.Text


End Sub

Private Sub Command17_Click()
txtfirst.Text = ""

txtsecond.Text = ""

 txtlabel.Text = ""
 
End Sub

Private Sub Command18_Click()

End

End Sub

Private Sub Command2_Click()

If txtlabel.Text = "" Then

   txtfirst.Text = txtfirst.Text + "2"
                      
                      Else
                      
   txtsecond.Text = txtsecond.Text + "2"
   
End If

End Sub

Private Sub Command3_Click()
If txtlabel.Text = "" Then

   txtfirst.Text = txtfirst.Text + "3"
                      
                      Else
                      
   txtsecond.Text = txtsecond.Text + "3"
   
End If
End Sub

Private Sub Command4_Click()

If txtlabel.Text = "" Then

   txtfirst.Text = txtfirst.Text + "4"
                      
                      Else
                      
   txtsecond.Text = txtsecond.Text + "4"
   
End If
End Sub

Private Sub Command5_Click()
If txtlabel.Text = "" Then

   txtfirst.Text = txtfirst.Text + "5"
                      
                      Else
                      
   txtsecond.Text = txtsecond.Text + "5"
   
End If
End Sub

Private Sub Command6_Click()
If txtlabel.Text = "" Then

   txtfirst.Text = txtfirst.Text + "6"
                      
                      Else
                      
   txtsecond.Text = txtsecond.Text + "6"
   
End If
End Sub

Private Sub Command7_Click()
If txtlabel.Text = "" Then

   txtfirst.Text = txtfirst.Text + "7"
                      
                      Else
                      
   txtsecond.Text = txtsecond.Text + "7"
   
End If
End Sub

Private Sub Command8_Click()
If txtlabel.Text = "" Then

   txtfirst.Text = txtfirst.Text + "8"
                      
                      Else
                      
   txtsecond.Text = txtsecond.Text + "8"
   
End If
End Sub

Private Sub Command9_Click()
If txtlabel.Text = "" Then

   txtfirst.Text = txtfirst.Text + "9"
                      
                      Else
                      
   txtsecond.Text = txtsecond.Text + "9"
   
End If
End Sub











Private Sub txtfirst_Change()

txtresult.Text = txtfirst.Text

End Sub

Private Sub txtfirst_KeyPress(KeyAscii As Integer)
If KeyAscii = 49 Then
Call Command1_Click

End Sub

Private Sub txtsecond_Change()
txtresult.Text = txtsecond.Text
End Sub

⌨️ 快捷键说明

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