📄 form10.frm
字号:
VERSION 5.00
Begin VB.Form Form10
BorderStyle = 1 'Fixed Single
Caption = "收支计算器"
ClientHeight = 2415
ClientLeft = 1650
ClientTop = 1665
ClientWidth = 2295
ForeColor = &H00000000&
Icon = "form10.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
PaletteMode = 1 'UseZOrder
ScaleHeight = 2415
ScaleWidth = 2295
Begin VB.Frame Frame1
BackColor = &H00C0C0C0&
Height = 1815
Left = 120
TabIndex = 0
Top = 480
Width = 2055
Begin VB.CommandButton Command5
BeginProperty Font
Name = "System"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1560
Picture = "form10.frx":030A
Style = 1 'Graphical
TabIndex = 20
Top = 1320
Width = 375
End
Begin VB.CommandButton Command2
Caption = "="
Height = 375
Index = 4
Left = 840
TabIndex = 19
Top = 1320
Width = 735
End
Begin VB.CommandButton Command1
Caption = "."
Height = 375
Index = 10
Left = 480
TabIndex = 18
Top = 1320
Width = 375
End
Begin VB.CommandButton Command1
Caption = "0"
Height = 375
Index = 0
Left = 120
TabIndex = 17
Top = 1320
Width = 375
End
Begin VB.CommandButton Command2
Caption = "*"
Height = 375
Index = 3
Left = 1560
TabIndex = 16
Top = 960
Width = 375
End
Begin VB.CommandButton Command2
Caption = "/"
Height = 375
Index = 2
Left = 1200
TabIndex = 15
Top = 960
Width = 375
End
Begin VB.CommandButton Command1
Caption = "9"
Height = 375
Index = 9
Left = 840
TabIndex = 14
Top = 960
Width = 375
End
Begin VB.CommandButton Command1
Caption = "8"
Height = 375
Index = 8
Left = 480
TabIndex = 13
Top = 960
Width = 375
End
Begin VB.CommandButton Command1
Caption = "7"
Height = 375
Index = 7
Left = 120
TabIndex = 12
Top = 960
Width = 375
End
Begin VB.CommandButton Command2
Caption = "-"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 1
Left = 1560
TabIndex = 11
Top = 600
Width = 375
End
Begin VB.CommandButton Command2
Caption = "+"
Height = 375
Index = 0
Left = 1200
TabIndex = 10
Top = 600
Width = 375
End
Begin VB.CommandButton Command1
Caption = "6"
Height = 375
Index = 6
Left = 840
TabIndex = 9
Top = 600
Width = 375
End
Begin VB.CommandButton Command1
Caption = "5"
Height = 375
Index = 5
Left = 480
TabIndex = 8
Top = 600
Width = 375
End
Begin VB.CommandButton Command1
Caption = "4"
Height = 375
Index = 4
Left = 120
TabIndex = 7
Top = 600
Width = 375
End
Begin VB.CommandButton Command4
Caption = "CE"
Height = 375
Left = 1560
TabIndex = 6
Top = 240
Width = 375
End
Begin VB.CommandButton Command3
Caption = "C"
Height = 375
Left = 1200
TabIndex = 5
Top = 240
Width = 375
End
Begin VB.CommandButton Command1
Caption = "3"
Height = 375
Index = 3
Left = 840
TabIndex = 4
Top = 240
Width = 375
End
Begin VB.CommandButton Command1
Caption = "2"
Height = 375
Index = 2
Left = 480
TabIndex = 3
Top = 240
Width = 375
End
Begin VB.CommandButton Command1
Caption = "1"
Height = 375
Index = 1
Left = 120
TabIndex = 2
Top = 240
Width = 375
End
End
Begin VB.Label text1
Alignment = 1 'Right Justify
BackColor = &H00000000&
BorderStyle = 1 'Fixed Single
Caption = "0."
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 315
Left = 120
TabIndex = 1
Top = 120
Width = 2055
End
End
Attribute VB_Name = "Form10"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim dflag As Integer
Dim i As Integer
Dim opnre As Integer
Dim prev As Double
Dim oflag As Integer
Dim ind As Integer
Private Sub Command1_Click(Index As Integer)
If ind = 4 Then
prev = 0
text1.Caption = " "
ind = 0
End If
opnre = 0
If oflag = 0 Then
text1.Caption = " "
End If
oflag = 1
If Command1(Index).Caption <> "." Then
If text1.Caption <> " 0" Then
text1.Caption = text1.Caption & Command1(Index).Caption
Else
text1.Caption = " " & Command1(Index).Caption
End If
Else
If dflag = 0 Then
text1.Caption = text1.Caption & "."
dflag = 1
Else
End If
End If
End Sub
Private Sub Command2_Click(Index As Integer)
If opnre = 0 Or Index = 4 Then
If ind = 0 Then
prev = prev + Val(text1.Caption)
ElseIf ind = 1 Then
prev = prev - Val(text1.Caption)
ElseIf ind = 2 Then
If Val(text1.Caption) = 0 Then
MsgBox "分母不能为0!"
Exit Sub
Else
prev = prev / Val(text1.Caption)
End If
ElseIf ind = 3 Then
prev = prev * Val(text1.Caption)
End If
text1.Caption = Str(prev)
oflag = 0
End If
opnre = 1
ind = Index
dflag = 0
End Sub
Private Sub Command3_Click()
text1.Caption = " 0"
End Sub
Private Sub Command4_Click()
dflag = 0
prev = 0
oflag = 0
ind = 0
opnre = 0
text1.Caption = " 0"
End Sub
Private Sub Command5_Click()
Unload Me
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc(".") Then
i = 10
Command1_Click (i)
ElseIf KeyAscii = Asc("0") Then
i = 0
Command1_Click (i)
ElseIf KeyAscii = Asc("1") Then
i = 1
Command1_Click (i)
ElseIf KeyAscii = Asc("2") Then
i = 2
Command1_Click (i)
ElseIf KeyAscii = Asc("3") Then
i = 3
Command1_Click (i)
ElseIf KeyAscii = Asc("4") Then
i = 4
Command1_Click (i)
ElseIf KeyAscii = Asc("5") Then
i = 5
Command1_Click (i)
ElseIf KeyAscii = Asc("6") Then
i = 6
Command1_Click (i)
ElseIf KeyAscii = Asc("7") Then
i = 7
Command1_Click (i)
ElseIf KeyAscii = Asc("8") Then
i = 8
Command1_Click (i)
ElseIf KeyAscii = Asc("9") Then
i = 9
Command1_Click (i)
ElseIf KeyAscii = Asc("0") Then
i = 0
Command1_Click (i)
ElseIf KeyAscii = Asc("+") Then
i = 0
Command2_Click (i)
ElseIf KeyAscii = Asc("+") Then
i = 0
Command2_Click (i)
ElseIf KeyAscii = Asc("-") Then
i = 1
Command2_Click (i)
ElseIf KeyAscii = Asc("/") Then
i = 2
Command2_Click (i)
ElseIf KeyAscii = Asc("*") Then
i = 3
Command2_Click (i)
ElseIf KeyAscii = Asc("=") Then
i = 4
Command2_Click (i)
ElseIf KeyAscii = Asc("c") Or KeyAscii = Asc("C") Then
dflag = 0
prev = 0
oflag = 0
ind = 0
opnre = 0
text1.Caption = " 0"
ElseIf KeyAscii = Asc("d") Or KeyAscii = Asc("D") Then
text1.Caption = " 0"
End If
End Sub
Private Sub Form_Load()
' standard.Height = 4090
' standard.Width = 3430
dflag = 0
prev = 0
oflag = 0
ind = 0
opnre = 0
Clipboard.Clear
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -