by Wizzkid (1 Submission)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 15th April 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Easy sample to plot a line in a Picturebox
API Declarations
dim Y as double
'### This program was made my Wizzkid ###
'Be sure you've got a Picturebox Called Picture1
'and a CommandButton called Command1
Private Sub cmdDraw_Click()
Call Drawaxis
x = -10
While x <= 10
'change (4)(3)(2)(1) to plot a other line
y = (4) * x ^ 3 + (3) * x ^ 2 + (2) * x + (1)
Picture1.PSet (5 * x + 50, 50 - 5 * y), RGB(255, 0, 0)
x = x + 0.01
Wend
End Sub
Private Sub drawaxis
Picture1.Cls
picture1.ScaleHeight = 100
picture1.ScaleWidth = 100
picture1.Line (50, 0)-(50, 100)
picture1.Line (0, 50)-(100, 50)
picture1.CurrentX = 45
picture1.CurrentY = 2
picture1.Print "y"
picture1.CurrentX = 95
picture1.CurrentY = 52
picture1.Print "x"
End Sub