Does anyone know the command that is used to plot a line (say, y = x) or a quadratic (e.g. y=x^2)
in VB? Does a command exist? Are there any sites I can go to that will give me the code? Thanks
Printable View
Does anyone know the command that is used to plot a line (say, y = x) or a quadratic (e.g. y=x^2)
in VB? Does a command exist? Are there any sites I can go to that will give me the code? Thanks
Use the line command... the coordinates you should pre-calculate or directly implement.. the following code will draw a function into Picture1:
Code:Dim x As Long
Dim ActY As Long
Dim LastY As Long
'Set scalemode.. vbPixels of course ;)
Picture1.ScaleMode = vbPixels
'Plot 100 points
For x = 0 To 100
ActY = x * (x / 100) 'Your formula here
'Draw line and store position
Picture1.Line (x - 1, LastY)-(x, ActY)
LastY = ActY
Next