📄 calculator_main_form.frm
字号:
Index = 12
Left = 3960
Top = 1080
Width = 495
_ExtentX = 873
_ExtentY = 873
ForeColor = 33023
TX = "-"
ENAB = -1 'True
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Calculator.Button Num
Height = 495
Index = 13
Left = 3360
Top = 1080
Width = 495
_ExtentX = 873
_ExtentY = 873
ForeColor = 33023
TX = "*"
ENAB = -1 'True
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Calculator.Button Num
Height = 495
Index = 14
Left = 2760
Top = 1080
Width = 495
_ExtentX = 873
_ExtentY = 873
ForeColor = 33023
TX = "/"
ENAB = -1 'True
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Calculator.Button Num
Height = 495
Index = 15
Left = 2160
Top = 2280
Width = 495
_ExtentX = 873
_ExtentY = 873
ForeColor = 255
TX = "("
ENAB = -1 'True
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Calculator.Button Num
Height = 495
Index = 16
Left = 2760
Top = 2280
Width = 495
_ExtentX = 873
_ExtentY = 873
ForeColor = 255
TX = ")"
ENAB = -1 'True
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Calculator.Button Num
Height = 495
Index = 17
Left = 3360
Top = 2280
Width = 495
_ExtentX = 873
_ExtentY = 873
ForeColor = 255
TX = "["
ENAB = -1 'True
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Calculator.Button Num
Height = 495
Index = 18
Left = 3960
Top = 2280
Width = 495
_ExtentX = 873
_ExtentY = 873
ForeColor = 255
TX = "]"
ENAB = -1 'True
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Calculator.Button Num
Height = 495
Index = 19
Left = 2760
Top = 1680
Width = 495
_ExtentX = 873
_ExtentY = 873
ForeColor = 8421504
TX = "Cos"
ENAB = -1 'True
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Calculator.Button Num
Height = 495
Index = 20
Left = 3360
Top = 1680
Width = 495
_ExtentX = 873
_ExtentY = 873
ForeColor = 8421504
TX = "Sin"
ENAB = -1 'True
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Calculator.Button Num
Height = 495
Index = 22
Left = 3960
Top = 1680
Width = 495
_ExtentX = 873
_ExtentY = 873
ForeColor = 8421504
TX = "Pi"
ENAB = -1 'True
BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Arial"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.TextBox Text2
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 120
TabIndex = 1
Top = 600
Width = 4335
End
Begin VB.TextBox Text3
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 120
Locked = -1 'True
TabIndex = 2
Top = 600
Width = 4335
End
Begin VB.Line Line1
BorderColor = &H00C00000&
BorderWidth = 4
X1 = 0
X2 = 4560
Y1 = 5280
Y2 = 5280
End
Begin VB.Image Image2
Height = 435
Left = 240
Top = 0
Width = 4335
End
Begin VB.Image Image1
Height = 5445
Left = 4680
Picture = "Calculator_Main_Form.frx":53F36
Top = 0
Visible = 0 'False
Width = 4605
End
End
Attribute VB_Name = "Calc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Declare All Variables
Dim Answ() As String, Nums, oX, oY
Public S As New clsShaped
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image3.Top = 0
End Sub
Private Sub Image2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
oX = X
oY = Y
End Sub
Private Sub Image2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Me.Top = Me.Top + Y - oY
Me.Left = Me.Left + X - oX
End If
Image3.Top = 0
End Sub
Private Sub Image3_Click()
End
End Sub
'Close Button Code
Private Sub Image3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image3.Top = 0 - (Image3.Height / 3) * 2
End Sub
Private Sub Image3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Not Image3.Top = 0 - (Image3.Height / 3) * 2 Then Image3.Top = 0 - (Image3.Height / 3)
End Sub
Private Sub Image3_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image3.Top = 0
End Sub
Private Sub Info_Click()
End Sub
''''''''''''''''''''''''''''''''''
Private Sub Num_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Text2.SetFocus
Text2.ZOrder 0
Text2.SelText = Nums(Index)
End Sub
Private Sub Syntax_Timer()
''''''''''''''''''''''
'Reset the "Syntax Error" messege
Text3.Text = ""
Text2.ZOrder 0
Text2.SetFocus
Text2.SelStart = 0
Text2.SelLength = Len(Text2)
ErrorMsg.Hide
Syntax.Enabled = False 'Disable Timer
End Sub
Private Sub Text3_GotFocus()
Text2.SelStart = Len(Text2)
End Sub
Private Sub Clr_Click()
Syntax.Enabled = False
'The CE Button Command
Text2.Text = "" 'Reset Problem Field
Text3.Text = "" 'Reset Answer Field
Text2.ZOrder 0 'Set Problem Feild On Top
Text2.SetFocus 'Set Focus to Problem Field
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'/'/'/''/'/'/'/'/''/'/'/'/'/''/'//////'/''/'/'/''/'/'/'/''/'/''/''/'/''/'/''/'/''/'/'/''/
'Solve Action (See For Your Self)
'/'/'/'/'/'/'/'/'/''/'/'/'/'////'/'//''/'/''/'/'/'/'/''/'/''/'/'/'/'/'/'/'/''/'/'/'/'/''/
Private Sub Solve_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Text2.Text = "" Then Exit Sub
Answ = Split(Text2.Text & " ")
Text2.Text = ""
For i = 0 To UBound(Answ())
Text2.Text = Text2.Text & Answ(i)
Next
Scripto = ""
Scripto = Scripto & "Ans=" & Text2 & Chr(13) & Chr(10) & Code
On Error GoTo Syntax:
Script.AddCode Scripto.Text
Script.Reset
Text3.ZOrder 0
Text3.SetFocus
Text3 = ""
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("c:\Answer.tmp")
Text3 = f.readline
f.Close
On Error Resume Next
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.DeleteFile("C:\Answer.tmp")
Exit Sub
Syntax:
ErrorMsg.Label1.Caption = Script.Error.Description
ErrorMsg.Label1.AutoSize = True
ErrorMsg.Height = ErrorMsg.Label1.Height + (ErrorMsg.Label1.Top * 2)
ErrorMsg.Width = ErrorMsg.Label1.Width + (ErrorMsg.Label1.Left * 2)
ErrorMsg.Top = Me.Top + Me.Height / 2
ErrorMsg.Left = Me.Left + Me.Width / 2 - ErrorMsg.Width / 2
ErrorMsg.Show
Syntax.Enabled = True
End Sub
Private Sub Form_Load()
Nums = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "+", "-", "*", "/", "(", ")", "[", "]", "Cos(", "Sin(", "SQR(", "*3.14")
For i = 0 To 9
Num(i).Caption = i
Next
S.Shape Me.hwnd, Image1.Picture, vbMagenta
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -