📄 圆锥曲线.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BackColor = &H00FFC0FF&
Caption = "打印各种曲线"
ClientHeight = 6555
ClientLeft = 60
ClientTop = 345
ClientWidth = 7215
Icon = "圆锥曲线.frx":0000
LinkTopic = "Form1"
ScaleHeight = 6555
ScaleWidth = 7215
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command9
Caption = "余弦曲线"
Height = 375
Left = 5400
TabIndex = 10
Top = 5520
Width = 1455
End
Begin VB.CommandButton Command8
Caption = "正弦曲线"
Height = 375
Left = 3960
TabIndex = 9
Top = 6120
Width = 1335
End
Begin VB.CommandButton Command7
Caption = "三叶线"
Height = 375
Left = 3960
TabIndex = 8
Top = 5520
Width = 1215
End
Begin VB.CommandButton Command6
Caption = "心形线"
Height = 375
Left = 2520
TabIndex = 7
Top = 6120
Width = 1335
End
Begin VB.CommandButton Command5
Caption = "阿基米德螺线"
Height = 375
Left = 2520
TabIndex = 6
Top = 5520
Width = 1335
End
Begin VB.CommandButton Command4
Caption = "设置系数"
Height = 375
Left = 240
TabIndex = 4
Top = 5520
Width = 975
End
Begin VB.CommandButton Command3
Caption = "圆锥曲线"
Height = 375
Left = 1440
TabIndex = 3
Top = 6120
Width = 975
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 375
Left = 5400
TabIndex = 2
Top = 6120
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "打印坐标"
Height = 375
Left = 1440
TabIndex = 1
Top = 5520
Width = 975
End
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
BackColor = &H00C0FFC0&
Height = 5295
Left = 240
ScaleHeight = 5235
ScaleWidth = 6795
TabIndex = 0
Top = 120
Width = 6855
End
Begin VB.Label Label1
Caption = "Label1"
Height = 375
Left = 240
TabIndex = 5
Top = 6000
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim x, r, k
Const pi = 3.14159
Private Sub Command1_Click()
Picture1.DrawWidth = 1
Picture1.Line (0, Picture1.ScaleHeight / 2)-(Picture1.ScaleWidth, Picture1.ScaleHeight / 2)
Picture1.Line (Picture1.ScaleWidth / 2, 0)-(Picture1.ScaleWidth / 2, Picture1.ScaleHeight)
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
k = Label1.Caption
x = 0.5
cd:
r = 800 / (1 - Cos(2 * pi * x / 360) * k)
Picture1.DrawWidth = 3
Picture1.PSet (Picture1.ScaleWidth / 2 + r * Cos(2 * pi * x / 360), Picture1.ScaleHeight / 2 + r * Sin(2 * pi * x / 360)), 250
If x < 359.5 Then x = x + 1 / 3
If x > 359.5 Then Exit Sub
GoTo cd
End Sub
Private Sub Command4_Click()
response$ = InputBox("输入系数k", "k<1,椭圆;x=1,抛物线;k>1,双曲线", "")
k = Val(response$)
Label1.Caption = k
End Sub
Private Sub Command5_Click()
x = 0
k = Label1.Caption
cd:
r = x * k / 3
Picture1.DrawWidth = 3
Picture1.PSet (Picture1.ScaleWidth / 2 + r * Cos(2 * pi * x / 360), Picture1.ScaleHeight / 2 + r * Sin(2 * pi * x / 360)), 25000
If x < 2160 Then x = x + 1 / 3
If x >= 2160 Then Exit Sub
GoTo cd
End Sub
Private Sub Command6_Click()
x = 0
k = Label1.Caption
cd:
r = 1000 * (1 - Cos(k * pi * x / 360))
Picture1.DrawWidth = 3
Picture1.PSet (Picture1.ScaleWidth / 2 + r * Cos(2 * pi * x / 360), Picture1.ScaleHeight / 2 + r * Sin(2 * pi * x / 360)), 200
If x < 720 Then x = x + 1 / 3
If x > 720 Then Exit Sub
GoTo cd
End Sub
Private Sub Command7_Click()
x = 0
k = Label1.Caption
cd:
r = 2500 * (Cos(k * pi * x / 360))
Picture1.DrawWidth = 3
Picture1.PSet (Picture1.ScaleWidth / 2 + r * Cos(2 * pi * x / 360), Picture1.ScaleHeight / 2 + r * Sin(2 * pi * x / 360)), 350
If x < 720 Then x = x + 1 / 3
If x >= 720 Then Exit Sub
GoTo cd
End Sub
Private Sub Command8_Click()
Picture1.DrawWidth = 3
For x = -200 To 200 Step 0.1
Picture1.PSet (80 * x + Picture1.ScaleWidth / 2, -900 * Sin(x / pi) + Picture1.ScaleHeight / 2), 50000
Next x
End Sub
Private Sub Command9_Click()
Picture1.DrawWidth = 3
For x = -200 To 200 Step 0.1
Picture1.PSet (80 * x + Picture1.ScaleWidth / 2, -900 * Cos(x / pi) + Picture1.ScaleHeight / 2), 250
Next x
End Sub
Private Sub Form_Load()
Label1.Caption = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -