?? +
字號:
TabIndex = 13
Top = 2400
Width = 495
End
Begin VB.CommandButton point
Caption = "."
BeginProperty Font
Name = "黑體"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1320
TabIndex = 12
Top = 2400
Width = 495
End
Begin VB.CommandButton cmdce
Caption = "CE"
BeginProperty Font
Name = "黑體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2520
TabIndex = 11
Top = 1800
Width = 495
End
Begin VB.CommandButton num
Caption = "0"
BeginProperty Font
Name = "黑體"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 0
Left = 120
TabIndex = 10
Top = 2400
Width = 495
End
Begin VB.CommandButton num
Caption = "1"
BeginProperty Font
Name = "黑體"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 1
Left = 120
TabIndex = 9
Top = 1800
Width = 495
End
Begin VB.CommandButton num
Caption = "2"
BeginProperty Font
Name = "黑體"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 2
Left = 720
TabIndex = 8
Top = 1800
Width = 495
End
Begin VB.CommandButton num
Caption = "3"
BeginProperty Font
Name = "黑體"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 3
Left = 1320
TabIndex = 7
Top = 1800
Width = 495
End
Begin VB.CommandButton num
Caption = "9"
BeginProperty Font
Name = "黑體"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 9
Left = 1320
TabIndex = 6
Top = 600
Width = 495
End
Begin VB.CommandButton num
Caption = "4"
BeginProperty Font
Name = "黑體"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 4
Left = 120
TabIndex = 5
Top = 1200
Width = 495
End
Begin VB.CommandButton num
Caption = "5"
BeginProperty Font
Name = "黑體"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 5
Left = 720
TabIndex = 4
Top = 1200
Width = 495
End
Begin VB.CommandButton num
Caption = "6"
BeginProperty Font
Name = "黑體"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 6
Left = 1320
TabIndex = 3
Top = 1200
Width = 495
End
Begin VB.CommandButton num
Caption = "8"
BeginProperty Font
Name = "黑體"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 8
Left = 720
TabIndex = 2
Top = 600
Width = 495
End
Begin VB.CommandButton num
Caption = "7"
BeginProperty Font
Name = "黑體"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 7
Left = 120
TabIndex = 1
Top = 600
Width = 495
End
Begin VB.Label value
Alignment = 1 'Right Justify
BackColor = &H00808000&
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "黑體"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 0
Top = 120
Width = 4095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim cal As Boolean
Private n(100) As Double
Private c(100) As Byte, m As Byte
Private Sub cmdce_Click()
value.Caption = "0"
cal = True
End Sub
Private Sub calu_Click(Index As Integer)
On Error GoTo err
Dim i As Byte
Dim res As Double
i = Len(value.Caption)
If InStr(value.Caption, ".") Then
Do While Mid(value.Caption, i, 1) = "0"
i = i - 1
Loop
If Mid(value.Caption, i, 1) = "." Then i = i - 1
value.Caption = Left(value.Caption, i)
End If
res = Val(value.Caption)
If m = 1 Then
n(1) = res
c(1) = Index
m = 2
ElseIf Index < 2 Or (c(m - 1) > 1 And Index > 1) Then
Call total(n(m - 1), res, c(m - 1))
c(m - 1) = Index
value.Caption = CStr(n(m - 1))
Else
n(m) = Val(value.Caption): c(m) = Index: m = m + 1
End If
cal = True
err:
End Sub
Private Sub equl_Click()
On Error GoTo err
Dim j As Integer
If m = 1 Then Exit Sub
n(m) = Val(value.Caption)
For j = m - 1 To 1 Step -1
Call total(n(j), n(m), c(j))
n(m) = n(j)
Next j
value.Caption = CStr(n(m))
m = 1
cal = True
err:
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57
num_Click (KeyAscii - 48)
Case 43
calu_Click (0)
Case 45
calu_Click (1)
Case 42
calu_Click (2)
Case 47
calu_Click (3)
Case 61
equl_Click
Case 46
point_Click
Case 45
sign_Click
End Select
End Sub
Private Sub Form_Load()
If App.PrevInstance Then End
value.Caption = "0"
cal = True
m = 1
Me.Caption = Me.Caption & "v" & App.Major & "." & App.Minor & App.Revision
End Sub
Private Sub num_Click(Index As Integer)
If value.Caption = "0" And Index = 0 Then Exit Sub
If cal Then
value.Caption = ""
cal = False
End If
value.Caption = value.Caption & Index
End Sub
Private Sub on_Click()
Dim i As Integer
m = 1
value.Caption = "0"
cal = True
For i = 0 To 4
vir(i).ToolTipText = ""
Next i
End Sub
Private Sub point_Click()
If InStr(value.Caption, ".") Then Exit Sub
If cal Then
value.Caption = "0"
cal = False
End If
value.Caption = value.Caption + "."
End Sub
Private Sub quit_Click()
End
End Sub
Private Sub sign_Click()
If value.Caption = "0" Then Exit Sub
If Left(value.Caption, 1) = "-" Then
value.Caption = Mid(value.Caption, 2, Len(value.Caption) - 1)
Else
value.Caption = "-" + value.Caption
End If
End Sub
Private Sub spci_Click(Index As Integer)
On Error GoTo err
Dim res As Double
Dim a As String
res = Val(value.Caption)
Select Case Index
Case 0
value.Caption = CStr(Sin(res))
Case 1
value.Caption = CStr(Cos(res))
Case 2
value.Caption = CStr(Tan(res))
Case 3
If res <= 0 Then a = "真數必須為正數"
value.Caption = CStr(Log(res) / Log(10))
Case 4
If res <= 0 Then a = "真數必須為正數"
value.Caption = CStr(Log(res))
Case 5
If res = 0 Then a = "0不能做除數"
value.Caption = CStr(1 / res)
Case 6
value.Caption = CStr(Exp(res))
End Select
cal = True
Exit Sub
err:
MsgBox a, vbCritical
End Sub
Private Sub vir_Click(Index As Integer)
Select Case Index
Case 5
value.Caption = pi
Case 6
value.Caption = Exp(1)
Case Else
If vir(Index).ToolTipText <> "" Then
value.Caption = vir(Index).ToolTipText
Else
vir(Index).ToolTipText = value.Caption
End If
End Select
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -