posts - 48,  comments - 5,  trackbacks - 0

          VERSION 5.00
          Begin VB.Form form1
             Caption         =   "微型計算器"
             ClientHeight    =   4065
             ClientLeft      =   60
             ClientTop       =   390
             ClientWidth     =   4845
             LinkTopic       =   "Form1"
             ScaleHeight     =   4065
             ScaleWidth      =   4845
             StartUpPosition =   3  '窗口缺省
             Begin VB.CommandButton del
                BackColor       =   &H00FFC0C0&
                Caption         =   "del"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   14.25
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   2400
                Style           =   1  'Graphical
                TabIndex        =   21
                Top             =   1080
                Width           =   1215
             End
             Begin VB.CommandButton off
                BackColor       =   &H00C0C0FF&
                Caption         =   "off"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   14.25
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   1200
                Style           =   1  'Graphical
                TabIndex        =   20
                Top             =   1080
                Width           =   1215
             End
             Begin VB.CommandButton cn
                BackColor       =   &H00C0FFC0&
                Caption         =   "cn"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   14.25
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   0
                MaskColor       =   &H00FF0000&
                Style           =   1  'Graphical
                TabIndex        =   19
                Top             =   1080
                UseMaskColor    =   -1  'True
                Width           =   1215
             End
             Begin VB.Timer Timer1
                Interval        =   1000
                Left            =   1800
                Top             =   600
             End
             Begin VB.CommandButton chu
                Caption         =   "/"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   3600
                TabIndex        =   16
                Top             =   2520
                Width           =   1215
             End
             Begin VB.CommandButton equal
                Caption         =   "="
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   3600
                TabIndex        =   15
                Top             =   3000
                Width           =   1215
             End
             Begin VB.CommandButton boil
                Caption         =   "."
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   2400
                TabIndex        =   14
                Top             =   3000
                Width           =   1215
             End
             Begin VB.CommandButton zero
                Caption         =   "0"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   0
                TabIndex        =   13
                Top             =   3000
                Width           =   2415
             End
             Begin VB.CommandButton sheng
                Caption         =   "*"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   3600
                TabIndex        =   12
                Top             =   2040
                Width           =   1215
             End
             Begin VB.CommandButton three
                Caption         =   "3"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   2400
                TabIndex        =   11
                Top             =   2520
                Width           =   1215
             End
             Begin VB.CommandButton two
                Caption         =   "2"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   1200
                TabIndex        =   10
                Top             =   2520
                Width           =   1215
             End
             Begin VB.CommandButton one
                Caption         =   "1"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   0
                TabIndex        =   9
                Top             =   2520
                Width           =   1215
             End
             Begin VB.CommandButton jian
                Caption         =   "-"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   3600
                TabIndex        =   8
                Top             =   1560
                Width           =   1215
             End
             Begin VB.CommandButton six
                Caption         =   "6"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   2400
                TabIndex        =   7
                Top             =   2040
                Width           =   1215
             End
             Begin VB.CommandButton five
                Caption         =   "5"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   1200
                TabIndex        =   6
                Top             =   2040
                Width           =   1215
             End
             Begin VB.CommandButton four
                Caption         =   "4"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   0
                TabIndex        =   5
                Top             =   2040
                Width           =   1215
             End
             Begin VB.CommandButton add
                Caption         =   "+"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   3600
                TabIndex        =   4
                Top             =   1080
                Width           =   1215
             End
             Begin VB.CommandButton nine
                Caption         =   "9"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   2400
                TabIndex        =   3
                Top             =   1560
                Width           =   1215
             End
             Begin VB.CommandButton eight
                Caption         =   "8"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   1200
                TabIndex        =   2
                Top             =   1560
                Width           =   1215
             End
             Begin VB.CommandButton seven
                Caption         =   "7"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   15.75
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   495
                Left            =   0
                TabIndex        =   1
                Top             =   1560
                Width           =   1215
             End
             Begin VB.TextBox result
                Alignment       =   1  'Right Justify
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   14.25
                   Charset         =   134
                   Weight          =   700
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                ForeColor       =   &H00FF0000&
                Height          =   495
                Left            =   0
                Locked          =   -1  'True
                TabIndex        =   0
                Top             =   0
                Width           =   4815
             End
             Begin VB.Label Label3
                Caption         =   "小小計算器  讓您用得稱心如意!^-^"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   14.25
                   Charset         =   134
                   Weight          =   400
                   Underline       =   0   'False
                   Italic          =   -1  'True
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   375
                Left            =   0
                TabIndex        =   22
                Top             =   3600
                Width           =   4815
             End
             Begin VB.Label Label2
                Caption         =   " 制作者   逍湘"
                Height          =   375
                Left            =   3360
                TabIndex        =   18
                Top             =   720
                Width           =   1455
             End
             Begin VB.Label Label1
                BorderStyle     =   1  'Fixed Single
                Caption         =   "當前時間"
                BeginProperty Font
                   Name            =   "宋體"
                   Size            =   12
                   Charset         =   134
                   Weight          =   400
                   Underline       =   0   'False
                   Italic          =   0   'False
                   Strikethrough   =   0   'False
                EndProperty
                Height          =   375
                Left            =   0
                TabIndex        =   17
                Top             =   600
                Width           =   1695
             End
          End
          Attribute VB_Name = "form1"
          Attribute VB_GlobalNameSpace = False
          Attribute VB_Creatable = False
          Attribute VB_PredeclaredId = True
          Attribute VB_Exposed = False
          Dim a As Double
          Dim b As Double
          Dim c As String

          Private Sub add_Click()
          If (result.Text = "+") Or (result.Text = "-") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          a = 0
          Else
          a = CDbl(result.Text)
          End If
          result.Text = "+"
          c = "+"
          End Sub

          Private Sub boil_Click()
          Dim str As String
          p = Split(result.Text)                    'Split:將字符串換成字符串數組
          str = Join(Filter(p, ".", True), "")      'Filter : 查找字符串數組的特定字符串
                                                    'Join(x[,d]) 將字符串數組合成一個字符串.
          If (result.Text = "+") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          result.Text = "0."
          Else
          If result.Text = "-" Then
          result.Text = result.Text + "0."
          End If
          End If

          If Len(str) > 0 Then           '已輸入的值中有點
          result.Text = result.Text
          Else
          If (CDbl(result.Text) > 0) Or (CDbl(result.Text) < 0) Or (result.Text = "-0") Then
          result.Text = result.Text + "."
          End If
          End If
          End Sub

          Private Sub chu_Click()
          If (result.Text = "+") Or (result.Text = "-") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          a = 0
          Else
          a = CDbl(result.Text)
          End If
          result.Text = "/"
          c = "/"
          End Sub

          Private Sub cn_Click()
          result.Text = ""
          a = 0
          b = 0
          End Sub

          Private Sub del_Click()
          If Len(result.Text) > 0 Then
          result.Text = Left(result.Text, Len(result.Text) - 1)
          End If
          End Sub

          Private Sub eight_Click()
          If (result.Text = "+") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          result.Text = "8"
          Else: result.Text = result.Text + "8"
          End If
          End Sub

          Private Sub equal_Click()
          If (result.Text = "+") Or (result.Text = "-") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          result.Text = "="
          b = 0
          Else
          If c = "-" Then
          b = -CDbl(result.Text)
          Else
          b = CDbl(result.Text)
          End If
          End If

          If c = "+" Then
          If ((a + b) < -1.7E+308) Or ((a + b) > 1.7E+308) Then
          MsgBox ("對不起,您所求的結果超出了本計算器范圍!請您選用更精密的計算器吧!")
          Else
          result.Text = CStr(a + b)
          End If
          End If

          If c = "-" Then
          If ((a - b) < -1.7E+308) Or ((a - b) > 1.7E+308) Then
          MsgBox ("對不起,您所求的結果超出了本計算器范圍!請您選用更精密的計算器吧!")
          Else
          result.Text = CStr(a - b)
          End If
          End If

          If c = "*" Then
          If ((a * b) < -1.7E+308) Or ((a * b) > 1.7E+308) Then
          MsgBox ("對不起,您所求的結果超出了本計算器范圍!請您選用更精密的計算器吧!")
          Else
          result.Text = CStr(a * b)
          End If
          End If

          If c = "/" Then
          If b = 0 Then
          MsgBox ("對不起,除數不能為 0 !!")
          Else
          If ((a / b) < -1.7E+308) Or ((a / b) > 1.7E+308) Then
          MsgBox ("對不起,您所求的結果超出了本計算器范圍!請您選用更精密的計算器吧!")
          Else
          result.Text = CStr(a / b)
          End If
          End If
          End If
          End Sub

          Private Sub five_Click()
          If (result.Text = "+") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          result.Text = "5"
          Else: result.Text = result.Text + "5"
          End If
          End Sub

          Private Sub four_Click()
          If (result.Text = "+") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          result.Text = "4"
          Else: result.Text = result.Text + "4"
          End If
          End Sub

          Private Sub jian_Click()
          If (result.Text = "+") Or (result.Text = "-") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          a = 0
          Else
          a = CDbl(result.Text)
          End If
          result.Text = "-"
          c = "-"
          End Sub


          Private Sub nine_Click()
          If (result.Text = "+") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          result.Text = "9"
          Else: result.Text = result.Text + "9"
          End If
          End Sub

          Private Sub off_Click()
          End
          End Sub

           

          Private Sub one_Click()
          If (result.Text = "+") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          result.Text = "1"
          Else: result.Text = result.Text + "1"
          End If
          End Sub

          Private Sub seven_Click()
          If (result.Text = "+") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          result.Text = "7"
          Else: result.Text = result.Text + "7"
          End If
          End Sub

          Private Sub sheng_Click()
          If (result.Text = "+") Or (result.Text = "-") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          a = 0
          Else
          a = CDbl(result.Text)
          End If
          result.Text = "*"
          c = "*"
          End Sub

          Private Sub six_Click()
          If (result.Text = "+") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          result.Text = "6"
          Else: result.Text = result.Text + "6"
          End If
          End Sub

          Private Sub three_Click()
          If (result.Text = "+") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          result.Text = "3"
          Else: result.Text = result.Text + "3"
          End If
          End Sub

          Private Sub Timer1_Timer()
          Label1.Caption = Time

          End Sub

          Private Sub two_Click()
          If (result.Text = "+") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          result.Text = "2"
          Else: result.Text = result.Text + "2"
          End If
          End Sub

          Private Sub zero_Click()
          If (result.Text = "+") Or (result.Text = "*") Or (result.Text = "/") Or (result.Text = "=") Or (result.Text = "") Then
          result.Text = "0."
          Else
          If result.Text = "-" Then
          result.Text = result.Text + "0."
          Else: result.Text = result.Text + "0"
          End If
          End If
          End Sub

          posted on 2008-01-05 10:14 逍湘 閱讀(716) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          留言簿(2)

          隨筆檔案(49)

          文章檔案(17)

          最新隨筆

          積分與排名

          • 積分 - 26329
          • 排名 - 1495

          最新評論

          閱讀排行榜

          主站蜘蛛池模板: 伊川县| 利辛县| 阿勒泰市| 黔东| 芦山县| 绥芬河市| 沙湾县| 信宜市| 盐山县| 宝山区| 璧山县| 泾阳县| 和硕县| 三都| 屏东县| 辉南县| 阿巴嘎旗| 大石桥市| 海宁市| 南皮县| 望谟县| 确山县| 扶余县| 伊宁县| 淄博市| 容城县| 措勤县| 沅江市| 长治市| 广南县| 高尔夫| 鲁山县| 麻江县| 磴口县| 大新县| 元江| 安新县| 额济纳旗| 黑龙江省| 胶州市| 盐城市|