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

📄 cacl.vb

📁 vb。net 2003数据库设计整套源代码
💻 VB
📖 第 1 页 / 共 2 页
字号:
Option Strict Off

Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
Imports Microsoft.VisualBasic


Public Class Calculator
    Inherits System.Windows.Forms.Form

    '数据变量
    Private mOp1, mOp2 As Double          '以前输入的操作数。
    Private mNumOps As Integer             '操作数的数目。
    Private mLastInput As Operation        '指示最后一个 KeyPress 事件的类型。
    Private mOpFlag As String              '指示挂起的操作。
    Private mOpPrev As String              '前一个操作
    Private mMinus As String               '与 "-" 的 #define 一样

    Private Enum Operation
        None = 0
        Operand
        Operator
        CE
        Cancel
    End Enum

    Public Sub New()
        MyBase.New()

        Calculator = Me

        '该调用是 Win 窗体设计器所必需的。
        InitializeComponent()

        'TODO:在 InitializeComponent() 调用之后添加任何初始化
        Reset()

        mMinus = "-"
    End Sub

    '窗体重写 dispose 以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region " Windows 窗体设计器生成的代码 "

    'Windows 窗体设计器所必需
    Private components As System.ComponentModel.Container
    Friend WithEvents CalcMenu As System.Windows.Forms.MainMenu
    Friend WithEvents CalcRes As System.Windows.Forms.Button
    Friend WithEvents CalcPlus As System.Windows.Forms.Button
    Friend WithEvents CalcDec As System.Windows.Forms.Button
    Friend WithEvents CalcSign As System.Windows.Forms.Button
    Friend WithEvents Calc0 As System.Windows.Forms.Button
    Friend WithEvents CalcCan As System.Windows.Forms.Button
    Friend WithEvents CalcSub As System.Windows.Forms.Button
    Friend WithEvents Calc3 As System.Windows.Forms.Button
    Friend WithEvents Calc2 As System.Windows.Forms.Button
    Friend WithEvents Calc1 As System.Windows.Forms.Button
    Friend WithEvents CalcCE As System.Windows.Forms.Button
    Friend WithEvents CalcMul As System.Windows.Forms.Button
    Friend WithEvents Calc6 As System.Windows.Forms.Button
    Friend WithEvents Calc5 As System.Windows.Forms.Button
    Friend WithEvents Calc4 As System.Windows.Forms.Button
    Friend WithEvents CalcBS As System.Windows.Forms.Button
    Friend WithEvents CalcDiv As System.Windows.Forms.Button
    Friend WithEvents Calc9 As System.Windows.Forms.Button
    Friend WithEvents Calc8 As System.Windows.Forms.Button
    Friend WithEvents Calc7 As System.Windows.Forms.Button
    Friend WithEvents CalcField As System.Windows.Forms.TextBox


    Dim WithEvents Calculator As System.Windows.Forms.Form

    '注意:以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。
    Private Sub InitializeComponent()
        Me.CalcSub = New System.Windows.Forms.Button()
        Me.CalcField = New System.Windows.Forms.TextBox()
        Me.CalcDiv = New System.Windows.Forms.Button()
        Me.CalcPlus = New System.Windows.Forms.Button()
        Me.CalcRes = New System.Windows.Forms.Button()
        Me.CalcCan = New System.Windows.Forms.Button()
        Me.Calc7 = New System.Windows.Forms.Button()
        Me.Calc6 = New System.Windows.Forms.Button()
        Me.CalcBS = New System.Windows.Forms.Button()
        Me.Calc4 = New System.Windows.Forms.Button()
        Me.Calc3 = New System.Windows.Forms.Button()
        Me.Calc2 = New System.Windows.Forms.Button()
        Me.CalcSign = New System.Windows.Forms.Button()
        Me.Calc0 = New System.Windows.Forms.Button()
        Me.Calc9 = New System.Windows.Forms.Button()
        Me.Calc8 = New System.Windows.Forms.Button()
        Me.CalcCE = New System.Windows.Forms.Button()
        Me.Calc5 = New System.Windows.Forms.Button()
        Me.CalcDec = New System.Windows.Forms.Button()
        Me.Calc1 = New System.Windows.Forms.Button()
        Me.CalcMul = New System.Windows.Forms.Button()
        Me.CalcMenu = New System.Windows.Forms.MainMenu()
        Me.SuspendLayout()
        '
        'CalcSub
        '
        Me.CalcSub.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.CalcSub.Location = New System.Drawing.Point(136, 128)
        Me.CalcSub.Name = "CalcSub"
        Me.CalcSub.Size = New System.Drawing.Size(30, 30)
        Me.CalcSub.TabIndex = 14
        Me.CalcSub.Text = "-"
        '
        'CalcField
        '
        Me.CalcField.BackColor = System.Drawing.SystemColors.Window
        Me.CalcField.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.CalcField.Location = New System.Drawing.Point(16, 8)
        Me.CalcField.Name = "CalcField"
        Me.CalcField.RightToLeft = System.Windows.Forms.RightToLeft.Yes
        Me.CalcField.Size = New System.Drawing.Size(192, 20)
        Me.CalcField.TabIndex = 0
        Me.CalcField.Text = "0."
        Me.CalcField.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'CalcDiv
        '
        Me.CalcDiv.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.CalcDiv.Location = New System.Drawing.Point(136, 48)
        Me.CalcDiv.Name = "CalcDiv"
        Me.CalcDiv.Size = New System.Drawing.Size(30, 30)
        Me.CalcDiv.TabIndex = 4
        Me.CalcDiv.Text = "/"
        '
        'CalcPlus
        '
        Me.CalcPlus.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.CalcPlus.Location = New System.Drawing.Point(136, 168)
        Me.CalcPlus.Name = "CalcPlus"
        Me.CalcPlus.Size = New System.Drawing.Size(30, 30)
        Me.CalcPlus.TabIndex = 19
        Me.CalcPlus.Text = "+"
        '
        'CalcRes
        '
        Me.CalcRes.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.CalcRes.Location = New System.Drawing.Point(176, 168)
        Me.CalcRes.Name = "CalcRes"
        Me.CalcRes.Size = New System.Drawing.Size(30, 30)
        Me.CalcRes.TabIndex = 20
        Me.CalcRes.Text = "="
        '
        'CalcCan
        '
        Me.CalcCan.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.CalcCan.Location = New System.Drawing.Point(176, 128)
        Me.CalcCan.Name = "CalcCan"
        Me.CalcCan.Size = New System.Drawing.Size(30, 30)
        Me.CalcCan.TabIndex = 15
        Me.CalcCan.Text = "C"
        '
        'Calc7
        '
        Me.Calc7.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Calc7.Location = New System.Drawing.Point(16, 48)
        Me.Calc7.Name = "Calc7"
        Me.Calc7.Size = New System.Drawing.Size(30, 30)
        Me.Calc7.TabIndex = 1
        Me.Calc7.Text = "7"
        '
        'Calc6
        '
        Me.Calc6.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Calc6.Location = New System.Drawing.Point(96, 88)
        Me.Calc6.Name = "Calc6"
        Me.Calc6.Size = New System.Drawing.Size(30, 30)
        Me.Calc6.TabIndex = 8
        Me.Calc6.Text = "6"
        '
        'CalcBS
        '
        Me.CalcBS.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.CalcBS.Location = New System.Drawing.Point(176, 48)
        Me.CalcBS.Name = "CalcBS"
        Me.CalcBS.Size = New System.Drawing.Size(30, 30)
        Me.CalcBS.TabIndex = 5
        Me.CalcBS.Text = "BS"
        '
        'Calc4
        '
        Me.Calc4.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Calc4.Location = New System.Drawing.Point(16, 88)
        Me.Calc4.Name = "Calc4"
        Me.Calc4.Size = New System.Drawing.Size(30, 30)
        Me.Calc4.TabIndex = 6
        Me.Calc4.Text = "4"
        '
        'Calc3
        '
        Me.Calc3.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Calc3.Location = New System.Drawing.Point(96, 128)
        Me.Calc3.Name = "Calc3"
        Me.Calc3.Size = New System.Drawing.Size(30, 30)
        Me.Calc3.TabIndex = 13
        Me.Calc3.Text = "3"
        '
        'Calc2
        '
        Me.Calc2.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Calc2.Location = New System.Drawing.Point(56, 128)
        Me.Calc2.Name = "Calc2"
        Me.Calc2.Size = New System.Drawing.Size(30, 30)
        Me.Calc2.TabIndex = 12
        Me.Calc2.Text = "2"
        '
        'CalcSign
        '
        Me.CalcSign.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.CalcSign.Location = New System.Drawing.Point(56, 168)
        Me.CalcSign.Name = "CalcSign"
        Me.CalcSign.Size = New System.Drawing.Size(30, 30)
        Me.CalcSign.TabIndex = 17
        Me.CalcSign.Text = "+/-"
        '
        'Calc0
        '
        Me.Calc0.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Calc0.Location = New System.Drawing.Point(16, 168)
        Me.Calc0.Name = "Calc0"
        Me.Calc0.Size = New System.Drawing.Size(30, 30)
        Me.Calc0.TabIndex = 16
        Me.Calc0.Text = "0"
        '
        'Calc9
        '
        Me.Calc9.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Calc9.Location = New System.Drawing.Point(96, 48)
        Me.Calc9.Name = "Calc9"
        Me.Calc9.Size = New System.Drawing.Size(30, 30)
        Me.Calc9.TabIndex = 3
        Me.Calc9.Text = "9"
        '
        'Calc8
        '
        Me.Calc8.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.Calc8.Location = New System.Drawing.Point(56, 48)
        Me.Calc8.Name = "Calc8"
        Me.Calc8.Size = New System.Drawing.Size(30, 30)
        Me.Calc8.TabIndex = 2
        Me.Calc8.Text = "8"
        '
        'CalcCE
        '
        Me.CalcCE.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.CalcCE.Location = New System.Drawing.Point(176, 88)
        Me.CalcCE.Name = "CalcCE"
        Me.CalcCE.Size = New System.Drawing.Size(30, 30)
        Me.CalcCE.TabIndex = 10
        Me.CalcCE.Text = "CE"
        '
        'Calc5

⌨️ 快捷键说明

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