|
- Private Sub Command1_Click() '单击命令按钮开始执行程序
- On Error Resume Next
- Dim X As Single
- Dim Y As Single
- Dim A As Double
- Dim k As Double
- Dim m As Double
- Dim b As Double
- If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
- MsgBox "信息填写不完整,请重填!", vbCritical, "错误"
- Exit Sub
- End If
- Cls '清屏幕
- A = Val(Text1.Text)
- k = Val(Text2.Text)
- m = Val(Text3.Text)
- b = Val(Text4.Text)
- Scale (-10, 10)-(10, -10) '定义新坐标系统的左上角和右下角坐标
-
- Line (-10, 0)-(10, 0) '绘制y轴
- Line (0, -10)-(0, 10) '绘制x轴
-
- '通过循环 画出函数点
- For X = -30 To 30 Step 0.0005
- If Option1.Value = True Then Y = A * Sin(k * X + m) + b
- If Option2.Value = True Then Y = A * Cos(k * X + m) + b
- If Option3.Value = True Then Y = A * Tan(k * X + m) + b
- PSet (X, Y), RGB(255, 0, 0)
- DoEvents
- Next X
- End Sub
- Private Sub Form_Load()
- If App.PrevInstance Then End
- End Sub
复制代码
|
|