📄 curves2d.frm
字号:
VERSION 5.00
Object = "*\A..\SOURCE\FAST2002.vbp"
Begin VB.Form frmCurves2D
BorderStyle = 3 'Fixed Dialog
Caption = "Curves2D Demo"
ClientHeight = 6465
ClientLeft = 45
ClientTop = 330
ClientWidth = 7770
Icon = "Curves2D.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6465
ScaleWidth = 7770
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin FLWGraphMath.FWCurves2D objCurves
Height = 5625
Left = 90
TabIndex = 17
Top = 750
Width = 5655
_ExtentX = 9975
_ExtentY = 9922
End
Begin VB.TextBox txtVarName
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 5850
TabIndex = 6
Text = "x"
Top = 2250
Width = 690
End
Begin VB.TextBox txtVarFrom
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 5850
TabIndex = 7
Text = "-5"
Top = 2925
Width = 690
End
Begin VB.TextBox txtVarTo
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 6795
TabIndex = 8
Text = "5"
Top = 2925
Width = 690
End
Begin VB.Frame fraFrame
Height = 555
Left = 3150
TabIndex = 13
Top = 135
Width = 2400
Begin VB.OptionButton optCoord
Caption = "Cartesians"
Height = 240
Index = 1
Left = 1125
TabIndex = 2
Top = 225
Width = 1185
End
Begin VB.OptionButton optCoord
Caption = "Polars"
Height = 240
Index = 0
Left = 180
TabIndex = 1
Top = 225
Width = 825
End
End
Begin VB.CheckBox chkYAxis
Caption = "Use Y axis"
Height = 240
Left = 5850
TabIndex = 4
Top = 900
Width = 1185
End
Begin VB.ComboBox cboExamples
Height = 315
ItemData = "Curves2D.frx":0442
Left = 5850
List = "Curves2D.frx":0444
Style = 2 'Dropdown List
TabIndex = 5
Top = 1530
Width = 1845
End
Begin VB.TextBox txtPoints
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 5760
TabIndex = 3
Text = "100"
Top = 315
Width = 1110
End
Begin VB.CommandButton cmdRefresh
Caption = "Refresh"
Default = -1 'True
Height = 375
Left = 5985
TabIndex = 9
Top = 3420
Width = 1365
End
Begin VB.TextBox txtExpression
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
Left = 90
TabIndex = 0
Top = 315
Width = 2850
End
Begin VB.Label lblLabel
AutoSize = -1 'True
Caption = "Var Name"
Height = 195
Index = 4
Left = 5850
TabIndex = 16
Top = 2025
Width = 705
End
Begin VB.Label lblLabel
AutoSize = -1 'True
Caption = "Max"
Height = 195
Index = 6
Left = 6795
TabIndex = 15
Top = 2700
Width = 300
End
Begin VB.Label lblLabel
AutoSize = -1 'True
Caption = "Min"
Height = 195
Index = 5
Left = 5850
TabIndex = 14
Top = 2700
Width = 255
End
Begin VB.Label lblLabel
AutoSize = -1 'True
Caption = "Examples"
Height = 195
Index = 2
Left = 5850
TabIndex = 12
Top = 1305
Width = 675
End
Begin VB.Label lblLabel
AutoSize = -1 'True
Caption = "Points"
Height = 195
Index = 3
Left = 5760
TabIndex = 11
Top = 90
Width = 435
End
Begin VB.Label lblLabel
AutoSize = -1 'True
Caption = "Expression"
Height = 195
Index = 0
Left = 90
TabIndex = 10
Top = 90
Width = 765
End
End
Attribute VB_Name = "frmCurves2D"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
With cboExamples
Call .AddItem("sinus")
Call .AddItem("cosinus")
Call .AddItem("ln( x ) - 1")
Call .AddItem("abs(sin(2*x)+x)")
Call .AddItem("Cardioide, Polars")
Call .AddItem("Lemniscata, Polars")
End With
cboExamples.ListIndex = 0
optCoord(1).Value = True
cmdRefresh.Value = True
End Sub
Private Sub cboExamples_Click()
Select Case cboExamples.ListIndex
Case 0
optCoord(1).Value = True
txtExpression = "sin(x)"
txtVarFrom = "-6.283194"
txtVarTo = "6.283194"
Case 1
optCoord(1).Value = True
txtExpression = "cos(x)"
txtVarFrom = "-6.283194"
txtVarTo = "6.283194"
Case 2
optCoord(1).Value = True
txtExpression = "ln( x ) - 1"
txtVarFrom = "-1"
txtVarTo = "10"
Case 3
optCoord(1).Value = True
txtExpression = "abs(sin(2*x)+x)"
txtVarFrom = "-5"
txtVarTo = "5"
Case 4
optCoord(0).Value = True
txtExpression = "12 * (1 - cos(t))"
txtVarFrom = "0"
txtVarTo = "6.283194"
Case 5
optCoord(0).Value = True
txtExpression = "12 * sqr(cos( 2 * t ))"
txtVarFrom = "0"
txtVarTo = "6.283194"
End Select
End Sub
Private Sub cmdRefresh_Click()
Dim strCaption As String
strCaption = Me.Caption
Me.Caption = Me.Caption & ", Redrawing... please wait a moment"
DoEvents
With objCurves
' sets the values
If optCoord(0).Value Then
.CoordinateType = FLWGraphMath.flwCurves2DCoordPolars
ElseIf optCoord(1).Value Then
.CoordinateType = FLWGraphMath.flwCurves2DCoordCartesians
End If
.Axis = IIf(chkYAxis = 0, FLWGraphMath.flwCurves2DAxisX, FLWGraphMath.flwCurves2DAxisY)
.Points = Val(txtPoints)
.Expression = txtExpression
.VarName = txtVarName
.VarFrom = Val(txtVarFrom)
.VarTo = Val(txtVarTo)
.DrawColor = vbBlue
.LineWidth = 2
' draws the curve
If .Error.Number <> 0 Then
Call MsgBox("Error: " & .Error.Description)
End If
End With
Me.Caption = strCaption
End Sub
Private Sub optCoord_Click(Index As Integer)
Select Case Index
Case 0
txtVarName = "t"
Case 1
txtVarName = "x"
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -