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

📄 计算器.frm

📁 计算器 计算器 计算器 计算器 计算器 计算器 计算器 计算器 计算器 计算器
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "计算器(学生型) --云中鹤"
   ClientHeight    =   3720
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   2895
   Icon            =   "计算器.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   MouseIcon       =   "计算器.frx":0442
   ScaleHeight     =   3720
   ScaleWidth      =   2895
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.Timer Timer1 
      Interval        =   200
      Left            =   720
      Top             =   3600
   End
   Begin VB.CommandButton Command11 
      Caption         =   "+/-"
      Height          =   330
      Left            =   1560
      MouseIcon       =   "计算器.frx":0884
      TabIndex        =   22
      Top             =   3240
      Width           =   480
   End
   Begin VB.CommandButton Command10 
      Caption         =   "CE"
      Height          =   375
      Left            =   1800
      TabIndex        =   21
      Top             =   720
      Width           =   975
   End
   Begin VB.CommandButton Command8 
      Caption         =   "退 格"
      Height          =   375
      Left            =   720
      TabIndex        =   20
      Top             =   720
      Width           =   975
   End
   Begin VB.TextBox Text1 
      Alignment       =   1  'Right Justify
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   120
      TabIndex        =   19
      Top             =   120
      Width           =   2655
   End
   Begin VB.CommandButton Command1 
      Caption         =   "1"
      Height          =   330
      Index           =   0
      Left            =   120
      MouseIcon       =   "计算器.frx":0CC6
      TabIndex        =   18
      Top             =   2760
      Width           =   480
   End
   Begin VB.CommandButton Command1 
      Caption         =   "2"
      Height          =   330
      Index           =   1
      Left            =   840
      MouseIcon       =   "计算器.frx":1108
      TabIndex        =   17
      Top             =   2760
      Width           =   480
   End
   Begin VB.CommandButton Command1 
      Caption         =   "3"
      Height          =   330
      Index           =   2
      Left            =   1560
      MouseIcon       =   "计算器.frx":154A
      TabIndex        =   16
      Top             =   2760
      Width           =   480
   End
   Begin VB.CommandButton Command1 
      Caption         =   "6"
      Height          =   330
      Index           =   5
      Left            =   1560
      MouseIcon       =   "计算器.frx":198C
      TabIndex        =   15
      Top             =   2280
      Width           =   480
   End
   Begin VB.CommandButton Command1 
      Caption         =   "5"
      Height          =   330
      Index           =   4
      Left            =   840
      MouseIcon       =   "计算器.frx":1DCE
      TabIndex        =   14
      Top             =   2280
      Width           =   480
   End
   Begin VB.CommandButton Command1 
      Caption         =   "4"
      Height          =   330
      Index           =   3
      Left            =   120
      MouseIcon       =   "计算器.frx":2210
      TabIndex        =   13
      Top             =   2280
      Width           =   480
   End
   Begin VB.CommandButton Command1 
      Caption         =   "9"
      Height          =   330
      Index           =   8
      Left            =   1560
      MouseIcon       =   "计算器.frx":2652
      TabIndex        =   12
      Top             =   1800
      Width           =   480
   End
   Begin VB.CommandButton Command1 
      Caption         =   "8"
      Height          =   330
      Index           =   7
      Left            =   840
      MouseIcon       =   "计算器.frx":2A94
      TabIndex        =   11
      Top             =   1800
      Width           =   480
   End
   Begin VB.CommandButton Command1 
      Caption         =   "7"
      Height          =   330
      Index           =   6
      Left            =   120
      MouseIcon       =   "计算器.frx":2ED6
      TabIndex        =   10
      Top             =   1800
      Width           =   480
   End
   Begin VB.CommandButton Command2 
      Caption         =   "+"
      Height          =   330
      Index           =   0
      Left            =   2280
      MouseIcon       =   "计算器.frx":3318
      TabIndex        =   9
      Top             =   1320
      Width           =   480
   End
   Begin VB.CommandButton Command3 
      Caption         =   "关闭"
      Height          =   330
      Left            =   120
      MouseIcon       =   "计算器.frx":375A
      MousePointer    =   99  'Custom
      TabIndex        =   8
      ToolTipText     =   "关闭计算器窗口"
      Top             =   1320
      Width           =   480
   End
   Begin VB.CommandButton Command4 
      Caption         =   "sqr"
      Height          =   330
      Left            =   840
      MouseIcon       =   "计算器.frx":3B9C
      TabIndex        =   7
      Top             =   1320
      Width           =   480
   End
   Begin VB.CommandButton Command5 
      Caption         =   "x^2"
      Height          =   330
      Left            =   1560
      MouseIcon       =   "计算器.frx":3FDE
      TabIndex        =   6
      Top             =   1320
      Width           =   480
   End
   Begin VB.CommandButton Command2 
      Caption         =   "-"
      Height          =   330
      Index           =   1
      Left            =   2280
      MouseIcon       =   "计算器.frx":4420
      TabIndex        =   5
      Top             =   1800
      Width           =   480
   End
   Begin VB.CommandButton Command2 
      Caption         =   "×"
      Height          =   330
      Index           =   2
      Left            =   2280
      MouseIcon       =   "计算器.frx":4862
      TabIndex        =   4
      Top             =   2280
      Width           =   480
   End
   Begin VB.CommandButton Command2 
      Caption         =   "/"
      Height          =   330
      Index           =   3
      Left            =   2280
      MouseIcon       =   "计算器.frx":4CA4
      TabIndex        =   3
      Top             =   2760
      Width           =   480
   End
   Begin VB.CommandButton Command1 
      Caption         =   "0"
      Height          =   330
      Index           =   9
      Left            =   120
      MouseIcon       =   "计算器.frx":50E6
      TabIndex        =   2
      Top             =   3240
      Width           =   480
   End
   Begin VB.CommandButton Command7 
      Caption         =   "."
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   840
      MouseIcon       =   "计算器.frx":5528
      TabIndex        =   1
      Top             =   3240
      Width           =   480
   End
   Begin VB.CommandButton Command9 
      Caption         =   "="
      Height          =   330
      Left            =   2280
      MouseIcon       =   "计算器.frx":596A
      TabIndex        =   0
      Top             =   3240
      Width           =   480
   End
   Begin VB.Image Image1 
      Height          =   480
      Left            =   120
      MouseIcon       =   "计算器.frx":5DAC
      MousePointer    =   99  'Custom
      Picture         =   "计算器.frx":61EE
      ToolTipText     =   "学习是一项很重要的事情!!"
      Top             =   630
      Width           =   480
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public num As String, num1 As String
Dim C As Integer, T As Integer
Dim A As Integer

Private Sub Command1_Click(Index As Integer)
    Text1.SetFocus
    num = num + Command1(Index).Caption
    Text1.Text = num
End Sub

Private Sub Command10_Click()
    '清空Text1,使操作数空
    Text1.Text = ""
    num = ""
End Sub

Private Sub Command11_Click()
If Text1.Text <> "" Then
    Text1.Text = -1 * Text1.Text
    num = Text1.Text
End If
End Sub

Private Sub Command2_Click(Index As Integer)
    num1 = num
    Text1.Text = ""
    num = ""
    C = Index
End Sub

Private Sub Command3_Click()
    End
End Sub
                                                '此处有一Bug,请大家修改!!
Private Sub Command4_Click()                     '如果不知道,想知道答案,请联系本人!
    Text1.Text = Sqr(Val(Text1.Text))           '提是:当输入负,那么错,根号不可为负
End Sub                                           'QQ:14845773

Private Sub Command5_Click()
    Text1.Text = Val(Text1.Text) * Val(Text1.Text)
End Sub

Private Sub Command7_Click()
    If InStr(num, ".") Then
        MsgBox "已经存在小数点!!"
        Exit Sub
    Else
        num = num + Command7.Caption
    End If
End Sub

Private Sub Command8_Click()
    T = Mid(Text1.Text, 1, Len(Text1.Text) - 1)    '此处有2个Bug,请大家修改!!
    Text1.Text = T                                 '如果不知道,想知道答案,请联系本人!
End Sub                                         '我的Email:vbsoft@3126.com

Private Sub Command9_Click()
    Select Case C
        Case 0
            num = Str(Val(num1) + Val(num))    '欢迎访问VB天下行
        Case 1
            num = Str(Val(num1) - Val(num))  'http://vbsoft.icpcn.com
        Case 2
            num = Str(Val(num1) * Val(num))
        Case 3
            If Val(num) = 0 Then
            MsgBox "除数不能为零!!"
            Text1.Text = ""
            num = ""
        Else
            num = Str(Val(num1) / Val(num))
        End If
    End Select
    Text1.Text = num
End Sub

Private Sub Form_Load()
    Image1.Picture = LoadPicture(App.Path & "\NOTE14.ICO")
End Sub

Private Sub Timer1_Timer()
    A = 0
    Image1.Left = Image1.Left + 100
    If A = 0 Then
        Image1.Left = Image1.Left - 100
        A = 1
    ElseIf A = 1 Then
        Image1.Left = Image1.Left + 100
        A = 0
    End If
End Sub

⌨️ 快捷键说明

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