计算器v b源代码 IMB standardization office【IMB 5AB- IMBK 08- IMB 2C】计算器vb源代码.txt性格本身没有好坏,乐观和悲观对这个世界都有贡献,前者发明了飞机,后者发明了降落伞。
完全版的前后台代码...'请把下面的保存为VERSIONBegin CalculatorBorderStyle = 1 'Fixed SingleCaption = "计算器"ClientHeight = 2970ClientLeft = 2580ClientTop = 1485ClientWidth = 3270ClipControls = 0 'FalseBeginProperty FontName = "System"Size =Charset = 0Weight = 700Underline = 0 'FalseItalic = 0 'FalseStrikethrough = 0 'FalseEndPropertyIcon = "":0000LinkMode = 1 'SourceLinkTopic = "Form1"MaxButton = 0 'FalsePaletteMode = 1 'UseZOrderScaleHeight = 2970ScaleWidth = 3270WhatsThisHelp = -1 'TrueBegin NumberCaption = "7"Height = 480Index = 7Left = 120TabIndex = 7Top = 600Width = 480EndBegin NumberCaption = "8" Height = 480 Index = 8Left = 720 TabIndex = 8Top = 600 Width = 480 EndBegin NumberCaption = "9" Height = 480 Index = 9Left = 1320 TabIndex = 9Top = 600 Width = 480 EndBegin CancelCaption = "C" Height = 480 Left = 2040 TabIndex = 10Top = 600 Width = 480 EndBegin CancelEntryCaption = "CE" Height = 480 Left = 2640 TabIndex = 11Top = 600 Width = 480 EndBegin NumberCaption = "4" Height = 480 Index = 4Left = 120 TabIndex = 4Top = 1200 Width = 480 EndBegin NumberCaption = "5" Height = 480 Index = 5Left = 720 TabIndex = 5Top = 1200 Width = 480 EndBegin NumberCaption = "6" Height = 480 Index = 6Left = 1320 TabIndex = 6Top = 1200 Width = 480 EndBegin OperatorCaption = "+" Height = 480 Index = 1Left = 2040 TabIndex = 12Top = 1200 Width = 480 EndBegin OperatorCaption = "-"Height = 480 Index = 3Left = 2640 TabIndex = 13Top = 1200 Width = 480 EndBegin NumberCaption = "1" Height = 480 Index = 1Left = 120 TabIndex = 1Top = 1800Width = 480 EndBegin NumberCaption = "2" Height = 480 Index = 2Left = 720 TabIndex = 2Top = 1800 Width = 480 EndBegin NumberCaption = "3" Height = 480 Index = 3Left = 1320 TabIndex = 3Top = 1800 Width = 480 EndBegin OperatorCaption = "X" Height = 480 Index = 2Left = 2040 TabIndex = 14Top = 1800 Width = 480 EndBegin OperatorCaption = "/"Height = 480 Index = 0Left = 2640 TabIndex = 15Top = 1800 Width = 480 EndBegin NumberCaption = "0" Height = 480 Index = 0Left = 120TabIndex = 0Top = 2400Width = 1080EndBegin DecimalCaption = "."Height = 480Left = 1320TabIndex = 18Top = 2400Width = 480EndBegin OperatorCaption = "="Height = 480Index = 4Left = 2040TabIndex = 16Top = 2400Width = 480EndBegin PercentCaption = "%"Height = 480Left = 2640TabIndex = 17Top = 2400Width = 480EndBegin ReadoutAlignment = 1 'Right JustifyBackColor = &H0000FFFF&BorderStyle = 1 'Fixed SingleCaption = "0."BeginProperty FontName = "MS Sans Serif" Size = 12Charset = 0Weight = 700Underline = 0 'FalseItalic = 0 'FalseStrikethrough = 0 'FalseEndPropertyForeColor = &H00000000&Height = 375Left = 120TabIndex = 19Top = 105Width = 3000EndEndAttribute VB_Name = "Calculator"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = False' --------------------------------------------------------------------------' 版权所有 (C) 1994 Microsoft Corporation'' 您可以免费以任何方式使用、修改、复制并分发您认为有用的 ' 示例应用程序文件 (或任何修改过的版本)。
Microsoft 对任何 ' 示例应用程序文件不做任何保证,不负任何责任和义务。
' --------------------------------------------------------------------------Option ExplicitDim Op1, Op2 ' 前面输入的操作数Dim DecimalFlag As Integer ' 小数点仍然存在吗Dim NumOps As Integer ' 操作数个数Dim LastInput ' 指示上一次按键事件的类型 Dim OpFlag ' 指示未完成的操作Dim TempReadout' C (取消) 按钮的 Click 事件过程' 重新设置显示并初始化变量Private Sub Cancel_Click()Readout = Format(0, "0.")Op1 = 0Op2 = 0Form_LoadEnd Sub' CE (取消输入) 按钮的 Click 事件过程Private Sub CancelEntry_Click()Readout = Format(0, "0.")DecimalFlag = FalseLastInput = "CE"End Sub' 小数点 (.) 按钮的 Click 事件过程' 如果上一次按键为运算符,初始化 readout 为 "0."; ' 否则显示时追加一个小数点Private Sub Decimal_Click()If LastInput = "NEG" ThenReadout = Format(0, "-0.")ElseIf LastInput <> "NUMS" ThenReadout = Format(0, "0.")End IfDecimalFlag = TrueLastInput = "NUMS"End Sub' 窗体的初始化过程' 设置所有变量为其初始值Private Sub Form_Load()DecimalFlag = FalseNumOps = 0LastInput = "NONE"OpFlag = " "Readout = Format(0, "0.")' = Format(0, ".")End Sub' 数字键 (0-9) 的 Click 事件过程' 向显示中的数追加新数Private Sub Number_Click(Index As Integer)If LastInput <> "NUMS" ThenReadout = Format(0, ".")DecimalFlag = FalseEnd IfIf DecimalFlag ThenReadout = Readout + Number(Index).CaptionElseReadout = Left(Readout, InStr(Readout, Format(0, ".")) - 1) + Number(Index).Caption + Format(0, ".")End IfIf LastInput = "NEG" Then Readout = "-" & ReadoutLastInput = "NUMS"End Sub' 运算符 (+, -, x, /, =) 的 Click 事件过程' 如果接下来的按键是数字键,增加 NumOps。