?? analyser.frm
字號:
VERSION 5.00
Begin VB.Form Analyser
Caption = "Form1"
ClientHeight = 3285
ClientLeft = 60
ClientTop = 405
ClientWidth = 7710
LinkTopic = "Form1"
ScaleHeight = 3285
ScaleWidth = 7710
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Draw
Caption = "作圖"
Height = 375
Left = 120
TabIndex = 11
Top = 2280
Width = 1215
End
Begin VB.PictureBox Picture1
Height = 2895
Left = 4440
MousePointer = 99 'Custom
ScaleHeight = 2835
ScaleMode = 0 'User
ScaleWidth = 3195
TabIndex = 10
Top = 360
Width = 3255
Begin VB.Line Line2
BorderColor = &H00FFC0C0&
X1 = 0
X2 = 3240
Y1 = 2880
Y2 = 2880
End
Begin VB.Line Line1
BorderColor = &H00FFC0C0&
X1 = 10000
X2 = 10000
Y1 = 0
Y2 = 2880
End
End
Begin VB.CommandButton Command1
Caption = "函數列表"
Height = 375
Left = 120
TabIndex = 9
Top = 1320
Width = 1215
End
Begin VB.CommandButton Help
Caption = "幫助"
Height = 375
Left = 120
TabIndex = 8
Top = 1800
Width = 1215
End
Begin VB.CommandButton WinCalc
Caption = "計算器"
Height = 375
Left = 120
TabIndex = 7
Top = 840
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "Val"
Height = 255
Left = 2640
TabIndex = 5
Top = 840
Width = 1575
End
Begin VB.CommandButton Command2
Caption = "Name"
Height = 255
Left = 1560
TabIndex = 4
Top = 840
Width = 1095
End
Begin VB.ListBox List2
Height = 2040
Left = 2640
TabIndex = 3
Top = 1080
Width = 1575
End
Begin VB.ListBox List1
Height = 2040
Left = 1560
TabIndex = 2
Top = 1080
Width = 1095
End
Begin VB.CommandButton AddSpace
Caption = "計算表達式"
Height = 375
Left = 120
TabIndex = 1
Top = 2760
Width = 1215
End
Begin VB.TextBox MainText
Height = 375
Left = 120
TabIndex = 0
Top = 120
Width = 4215
End
Begin VB.Frame Frame1
Caption = "常數列表"
Height = 2655
Left = 1440
TabIndex = 6
Top = 600
Width = 2895
End
Begin VB.Label Label1
Height = 255
Left = 4440
TabIndex = 12
Top = 120
Width = 3255
End
Begin VB.Menu Menu
Caption = "Menu"
Visible = 0 'False
Begin VB.Menu MenuDelete
Caption = "刪除"
End
Begin VB.Menu MenuAdd
Caption = "添加"
End
Begin VB.Menu MenuModify
Caption = "修改"
End
Begin VB.Menu MenuInfo
Caption = "說明"
End
End
End
Attribute VB_Name = "Analyser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim SX As Single, SY As Single
Dim G As Boolean
Private Sub AddSpace_Click()
ReDim ConstInfo1(1 To 1)
For i = 0 To List1.ListCount - 1
Module1.InputConst List1.List(i), List2.List(i)
Next i
InText = MainText.Text
MainText.Text = Module1.Initialize(MainText.Text)
If MainText.Text <> InText Then MainText.Text = Val(MainText.Text)
End Sub
Private Sub Command1_Click()
MsgBox "函數列表" & Chr(10) & Chr(13) _
& "sin 正弦函數" & Chr(10) & Chr(13) _
& "cos余弦函數" & Chr(10) & Chr(13) _
& "tan正切函數" & Chr(10) & Chr(13) _
& "rnd 隨即數" & Chr(10) & Chr(13) _
& "abs 絕對值" & Chr(10) & Chr(13) _
& "exp 自然對數e的n次方" & Chr(10) & Chr(13) _
& "fix 取整" & Chr(10) & Chr(13) _
& "int 取整" & Chr(10) & Chr(13) _
& "log 對數函數" & Chr(10) & Chr(13) _
& "sqr或者sqrt 平方根" & Chr(10) & Chr(13) _
& "Int 和 Fix 的不同之處在于,如果 number 為負數,則 Int 返回小于或等于 number 的第一個負整數,而 Fix 則會返回大于或等于 number 的第一個負整數。例如,Int 將 -8.4 轉換成 -9,而 Fix 將 -8.4 轉換成 -8。"
End Sub
Private Sub draw_Click()
On Error Resume Next
G = True
Dim iii As Integer
For i = 1 To Len(MainText.Text)
If Mid(MainText.Text, i, 1) = "X" Or Mid(MainText.Text, i, 1) = "x" Then iii = iii + 1
Next i
If iii = 0 Then MsgBox ("未能找到常數X"): Exit Sub
Picture1.Picture = LoadPicture("")
Picture1.AutoRedraw = True
Picture1.Line (0, -20)-(0, 20)
Picture1.Line (-20, 0)-(20, 0)
For SX = -20 To 20 Step 0.1
ReDim ConstInfo1(1 To 1)
For i = 0 To List1.ListCount - 1
Module1.InputConst List1.List(i), List2.List(i)
Next i
Module1.InputConst "X", SX
InText = MainText.Text
SY = Module1.Initialize(MainText.Text)
Picture1.PSet (SX, SY)
Next SX
Picture1.AutoRedraw = False
End Sub
Private Sub Form_Load()
Picture1.Scale (-20, 20)-(20, -20)
Picture1.Picture = LoadPicture("")
Picture1.AutoRedraw = True
Picture1.Line (0, -20)-(0, 20)
Picture1.Line (-20, 0)-(20, 0)
Picture1.AutoRedraw = False
List1.AddItem ("G")
List2.AddItem (9.807)
List1.AddItem ("P")
List2.AddItem (3.142)
SX = SX + 1
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
Private Sub Help_Click()
MsgBox "歡迎使用本軟件!" & Chr(10) & Chr(13) _
& "本軟件用于分析并計算數學表達式或者畫圖。您可以用各種運算方法和函數進行復雜的運算。" & Chr(10) & Chr(13) _
& "您可以在字符框里以自然的方式輸入表達式,但是還是有些需要注意的地方。這些是不可以弄錯的。" & Chr(10) & Chr(13) _
& "首先,這里沒有點乘,也不可以忽略它。例如平時我們習慣的將A乘以B寫為AB,但是您在此不得不寫為A*B" & Chr(10) & Chr(13) _
& "第二,在運算中,函數擁有最高的優先權。這意味著sin 3^2 =(sin 3)^2。如果您不希望這樣,請用括號括起他們。" & Chr(10) & Chr(13) _
& "第三,如果一個常數緊跟一個函數,請把常數括起來。例如sin(G)就不會發生錯誤" & Chr(10) & Chr(13) _
& "第四,為了讓程序區分負號和減號,減號一律用下劃線“_”代替……出了問題別怪我沒提醒……" & Chr(10) & Chr(13) _
& "最后,由于本人技術不高,又為了狗日的自然書寫,因此如果……正確的表達式發生了錯誤或答案不正確,那么……" & Chr(10) & Chr(13) _
& "關于作圖,很簡單,把X當作一個常數就行了。不過呢……有可能……比較慢……" & Chr(10) & Chr(13) _
& "祝這個軟件能幫上大家一些忙~謝謝大家的支持~還有,有問題還請多多包涵……并且聯系我。制作人CauLiFloWeR。" & Chr(10) & Chr(13) _
& "關于固定函數請見相關幫助。在常數列表框內點擊右鍵以操作常數并取得常數的幫助。"
End Sub
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
List2.ListIndex = List1.ListIndex
If Button = 2 Then
PopupMenu Menu
End If
End Sub
Private Sub List2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
List1.ListIndex = List2.ListIndex
If Button = 2 Then
PopupMenu Menu
End If
End Sub
Private Sub MainText_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then AddSpace_Click
End Sub
Private Sub MenuAdd_click()
On Error Resume Next
Dim Name As String, V As Integer
Abcd: Name = UCase(InputBox("Enter Name"))
If Name = "" Or Len(Name) <> 1 Or IsNumeric(Name) = True Or Name = "X" Then MsgBox ("錯誤的命名。請查閱說明。"): GoTo Abcd
V = Val(InputBox("Enter Val"))
List1.AddItem Name
List2.AddItem V
End Sub
Private Sub Menumodify_click()
On Error Resume Next
Dim Name As String, V As Integer
Abc: Name = InputBox("Enter Name", , List1.List(List1.ListIndex))
If Name = "" Or Len(Name) <> 1 Or IsNumeric(Name) = True Or Name = "X" Then MsgBox ("錯誤的命名。請查閱說明。"): GoTo Abc
V = Val(InputBox("Enter Val", , List1.List(List2.ListIndex)))
List1.List(List1.ListIndex) = Name
List2.List(List2.ListIndex) = V
End Sub
Private Sub Menudelete_click()
On Error Resume Next
If MsgBox("You are sure to delete?", vbYesNo) = vbYes Then
List1.RemoveItem List1.ListIndex
List2.RemoveItem List2.ListIndex
Else
Exit Sub
End If
End Sub
Private Sub Menuinfo_click()
MsgBox "您可以在計算時用常數替代一些復雜而重復的數。您也可以自定義常數。" & Chr(10) & Chr(13) _
& "您可以添加 刪除 修改常數,但常數的名稱必須是大寫的單個英文字母(不可以為X)不能有有多余的空格;常數的數值必須是一個不太長的數字。如果不是大寫系統將自動轉換……我好象說廢話了" & Chr(10) & Chr(13) _
& "但是在輸入表達式時并沒有類似規定;您可以小寫,或則不空格也可以。", , "幫助"
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If G Then
Dim AY As Single
ReDim ConstInfo1(1 To 1)
For i = 0 To List1.ListCount - 1
Module1.InputConst List1.List(i), List2.List(i)
Next i
Module1.InputConst "X", Round(X, 3)
AY = Val(Module1.Initialize(MainText.Text))
Label1.Caption = Round(X, 3) & " : " & AY
Line1.X1 = X: Line1.X2 = X
Line2.Y1 = AY: Line2.Y2 = AY
End If
End Sub
Private Sub WinCalc_Click()
Shell "C:\WINDOWS\system32\CALC.EXE"
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -