Results 1 to 2 of 2

Thread: Question re: Linear equations and quadratics

  1. #1

    Thread Starter
    Lively Member fundean's Avatar
    Join Date
    Apr 2001
    Posts
    98

    Question re: Linear equations and quadratics

    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

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    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
    Last edited by Fox; May 29th, 2001 at 09:51 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width