这段vb有问题吗

来源:百度知道 编辑:UC知道 时间:2024/06/20 15:18:32
Private Sub Form_paint()
With Picture1
.Height = Me.ScaleHeight
.ScaleMode = 6
oldx = .ScaleWidth / 2
oldy = .ScaleHeight / 2
.Cls '画坐标轴
Picture1.Line (oldx, .Top)-(oldx, .ScaleHeight), RGB(255, 0, 0)
Picture1.Line (0, oldy)-(.ScaleWidth, oldy), RGB(255, 0, 0)
End With
Picture1.CurrentX = oldx - 4
Picture1.CurrentY = oldy + 0.5 '画坐标原点
Picture1.Print 0
For xt = -Int(oldx) To Int(oldx) Step 0.5
If xt <> 0 Then
st = xt * 10 * pi
Picture1.CurrentX = oldx + st - 3
Picture1.CurrentY = oldy + 0.5 '画X轴的刻度
Picture1.Print xt & "π"
Picture1.Line (oldx + st, oldy - 1)-(oldx + st, oldy), RGB(255, 111, 231)
End If
Next xt
For yt = -5 To 7
If yt <> 0 Then
st = yt * 10
Picture1.CurrentX = oldx - 4
Picture1.CurrentY = oldy + st - 1

xt\st\pi没定义

Dim xt As Double
Dim st As Double
Dim pi As Double
Private Sub Form_paint()
pi = 3.1416
With Picture1
.Height = Me.ScaleHeight
.ScaleMode = 6
oldx = .ScaleWidth / 2
oldy = .ScaleHeight / 2
.Cls '画坐标轴
Picture1.Line (oldx, .Top)-(oldx, .ScaleHeight), RGB(255, 0, 0)
Picture1.Line (0, oldy)-(.ScaleWidth, oldy), RGB(255, 0, 0)
End With
Picture1.CurrentX = oldx - 4
Picture1.CurrentY = oldy + 0.5 '画坐标原点
Picture1.Print 0
For xt = -Int(oldx) To Int(oldx) Step 0.5
If xt <> 0 Then
st = xt * 10 * pi
Picture1.CurrentX = oldx + st - 3
Picture1.CurrentY = oldy + 0.5 '画X轴的刻度
Picture1.Print xt & "π"
Picture1.Line (oldx + st, oldy - 1)-(oldx + st, oldy), RGB(255, 111, 231)
End If
Next xt
For yt = -5 To 7