帮帮忙,谢谢大侠,VB
<P>Private Sub cmdPlot_Click()XY
On Error Resume Next
Dim x As Double, Y As Double
Randomize
SC.Reset
SC.AddCode "Function RunThis(X)" & vbCrLf & "RunThis=" & txtEquation & vbCrLf & "End Function"
For x = -15 To 15 Step 0.001
Y = SC.Run("runthis", x)
DoEvents
Picture1.PSet (x, Y), RGB(250, 0, 0)
Next x
End Sub</P>
<P>为仕么Y=LOG(X),SQR(X)也有图象(X轴负半轴),请帮忙</P> 把完整代码发上来 <P><b>帮帮忙,跪下谢谢斑竹,VB</b></P><P>Private Function PrintWord(x, Y, Word As String)
With Picture1
.CurrentX = x
.CurrentY = Y
.ForeColor = RGB(0, 0, 255)
End With
Picture1.Print Word
End Function
'定义画点函数
Private Function DrawDot(Px, Py, Color)
Picture1.PSet (Px, Py), Color
End Function
Sub XY() '建立直角坐标系
Picture1.DrawWidth = 1 '设置线条宽度
Picture1.Cls
'设定用户坐标系,坐标原点在Picture1中心
Picture1.Scale (-10, 10)-(10, -10)
Picture1.Line (-10, 0)-(10, 0), RGB(0, 0, 255)
Picture1.Line -(9.5, 0.5), RGB(0, 0, 255)
Picture1.Line (10, 0)-(9.5, -0.5), RGB(0, 0, 255)
Picture1.ForeColor = RGB(0, 0, 255)
Picture1.Print "X"
'画 X 轴
Picture1.Line (0, -10)-(0, 10), RGB(0, 0, 255)
Picture1.Line -(0.5, 9.5), RGB(0, 0, 255)
Picture1.Line (0, 10)-(-0.5, 9.5), RGB(0, 0, 255)
Picture1.Print "Y"
'画 Y 轴
For lin = -9 To 9
Picture1.Line (lin, 0)-(lin, 0.25)
wor = PrintWord(lin - 0.5, -0.5, Str(lin))
Picture1.Line (0, lin)-(-0.25, lin)
If lin <> 0 Then
wor = PrintWord(-0.9, lin, Str(lin))
End If
Next lin
Picture1.DrawWidth = 1
End Sub
Private Sub cmdPlot_Click()
XY
On Error Resume Next
Dim x As Double, Y As Double
Randomize
SC.Reset
SC.AddCode "Function RunThis(X)" & vbCrLf & "RunThis=" & txtEquation & vbCrLf & "End Function"
For x = -15 To 15 Step 0.001
Y = SC.Run("runthis", x)
DoEvents
Picture1.PSet (x, Y), RGB(250, 0, 0)
Next x
End Sub</P><P>Private Sub Command2_Click()
XY
End Sub</P><P>Private Sub Command3_Click()
End
End Sub</P><P>
Private Sub Form_Load()
Me.Caption = "美丽曲线——山东省商河一中路来民"
Me.Show
Me.AutoRedraw = True
XY
End Sub
控件</P><P>为仕么Y=LOG(X),SQR(X)也有图象(X轴负半轴), SC为MS.SCRIPT.control请帮忙,谢谢斑竹,跪谢!!!</P> 呵呵,看大家评论如何
static/image/common/sigline.gif
大家好,能交朋友嘛?ok0633.com 我看不错噢 谢谢楼主!
页:
[1]