怎样用vb画函数图像?怎么用VB
Option Explicit
Dim i As Integer
Dim yy(100) As Single
Dim xx As Single
Dim colvb As Long
Dim x As Integer
Dim y As Integer
Dim txt As String
Dim dy As Variant
Public Function xp(colvb As Variant, x As Variant, y As Variant, txt As Variant)
Me。 ForeColor = colvb 'QBColor(14)
Me。CurrentX = x
Me。Cu...全部
Option Explicit
Dim i As Integer
Dim yy(100) As Single
Dim xx As Single
Dim colvb As Long
Dim x As Integer
Dim y As Integer
Dim txt As String
Dim dy As Variant
Public Function xp(colvb As Variant, x As Variant, y As Variant, txt As Variant)
Me。
ForeColor = colvb 'QBColor(14)
Me。CurrentX = x
Me。CurrentY = y
Me。Print txt '
End Function
Private Sub Command1_Click()
For i = 0 To 100
xx = (i - 50) / 10
yy(i) = 0。
5 * xx ^ 2 + 3 * xx - 2
Next
Line (0, 4000)-(10000, 4000)
Line (5000, 0)-(5000, 8000)
Line (6000, 3950)-(6000, 4000)
Line (4000, 3950)-(4000, 4000)
Line (5000, 3000)-(5100, 3000)
Line (5000, 5000)-(5100, 5000)
For i = 0 To 100
PSet ((i - 50) * 10 + 5000, -1 * yy(i) * 100 + 4000), vbRed
Next
x = 9000
y = 3900
txt = "X轴"
colvb = vbBlue
dy = xp(colvb, x, y, txt)
x = 5100
y = 500
txt = "y轴"
colvb = vbBlue
dy = xp(colvb, x, y, txt)
x = 5000
y = 4000
txt = "0"
dy = xp(colvb, x, y, txt)
x = 6000 - 70
y = 4000
txt = "10"
dy = xp(colvb, x, y, txt)
x = 4000 - 70
y = 4000
txt = "-10"
dy = xp(colvb, x, y, txt)
x = 5100
y = 2930
txt = "10"
dy = xp(colvb, x, y, txt)
x = 5100
y = 4930
txt = "-10"
dy = xp(colvb, x, y, txt)
End Sub
。
收起