Private Sub cmdDraw_Click()
Const PI = 3.14159265
Dim A As Single
Dim B As Single
Dim theta As Single
Dim dtheta As Single
A = CSng(txtA.Text)
B = CSng(txtB.Text)
picGraph.ScaleLeft = 0
picGraph.ScaleWidth = 4 * PI
picGraph.ScaleTop = 2
picGraph.ScaleHeight = -4
picGraph.AutoRedraw = True
theta = 0
picGraph.Cls
picGraph.CurrentX = theta
picGraph.CurrentY = Sin(A * theta) + Sin(B * theta)
dtheta = 4 * PI / picGraph.ScaleX(picGraph.ScaleWidth, _
picGraph.ScaleMode, vbPixels)
Do While theta <= 4 * PI + dtheta / 2
picGraph.Line -(theta, Sin(A * theta) + Sin(B * _
theta))
theta = theta + dtheta
Loop
End Sub
|