如何用VB作可以改变为任意系数的函数图像

来源:百度知道 编辑:UC知道 时间:2024/05/30 05:02:29
要利用TEXT框输入系数

我也正在等这问题的解决,给你一个时好时坏的程序吧,这程序我运行了,两个一模一样的代码,一个可以,一个不可以。
Option Explicit
Const PI As Double = 3.1415927
Private Sub Command1_Click()
Dim a As Double, b As Double, c As Double, d As Double, i As Double, t1 As Double, t2 As Double
If Not (IsNumeric(Text1) Or IsNumeric(Text2) Or IsNumeric(Text3) Or IsNumeric(Text4)) Then
MsgBox ("输入错误!")
End
End If
MathPic.Cls
MathPic.Scale (-2 * PI, 2)-(2 * PI, -2)
MathPic.Line (-2 * PI, 0)-(2 * PI, 0)
MathPic.Line (0, 2)-(0, -2)
With MathPic
.CurrentX = 0: .CurrentY = 0: MathPic.Print 0
.CurrentX = 2 * PI - 0.2: .CurrentY = 0.2: MathPic.Print "X"
.CurrentX = 0.05: .CurrentY = 1.8: MathPic.Print "Y"
End With
a = Val(Text1): b = Val(Text2): c = Val(Text3): d = Val(Text4)
i = -2 * PI
For i = -2 * PI To 2 * PI Step 0.001
t1 = b * i + c: t2 = b * (i - 0.0001) + c
MathPic.Line (i, a * Sin(t1) + d)-(i + 0.001, a * Sin