VB的picturebox怎么画函数图像y=x^2+2*x啊,
来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/08/19 01:02:12
VB的picturebox怎么画函数图像y=x^2+2*x啊,
![VB的picturebox怎么画函数图像y=x^2+2*x啊,](/uploads/image/z/8746385-41-5.jpg?t=VB%E7%9A%84picturebox%E6%80%8E%E4%B9%88%E7%94%BB%E5%87%BD%E6%95%B0%E5%9B%BE%E5%83%8Fy%3Dx%5E2%2B2%2Ax%E5%95%8A%2C)
Private Sub Command1_Click()
Dim x As Integer
Dim y As Double
Dim startX As Integer
Dim startY As Double
Dim nextX As Integer
Dim nextY As Double
startX = 0
startY = 0
For x = 0 To 100
y = x * x + 2 * x
nextX = x
nextY = Form1.Height - y
Form1.Line (startX,startY)-(nextX,nextY)
startX = nextX
startY = nextY
Next
End Sub
我在窗体上画线,没在picturebox画,改成picturebox就行了
Dim x As Integer
Dim y As Double
Dim startX As Integer
Dim startY As Double
Dim nextX As Integer
Dim nextY As Double
startX = 0
startY = 0
For x = 0 To 100
y = x * x + 2 * x
nextX = x
nextY = Form1.Height - y
Form1.Line (startX,startY)-(nextX,nextY)
startX = nextX
startY = nextY
Next
End Sub
我在窗体上画线,没在picturebox画,改成picturebox就行了