# Thread: drawing the function graphic

1. ## drawing the function graphic

Hi friends,

these are my code

vb Code:
`Option Explicit Const i3 As Integer = 1Const i2 As Integer = 2Const i1 As Integer = 1Const xmin As Integer = -10Const xmax As Integer = 10Const ymin As Integer = 0Const ymax As Integer = 121Const N As Integer = 20    Private Sub Form_Load()Dim i As IntegerDim A As Double      Scale (xmin, ymax)-(xmax, ymin)    Line (xmin, 0)-(xmax, 0)    Line (0, ymin)-(0, ymax)    PSet (xmin, Pol(xmin))            For i = xmin To xmax Step (xmax - xmin) / N            A = Pol(i)            Line -(i, A)            Circle (i, A), 0.005        Next                    End Sub Function Pol(x As Integer) As Double Dim y As Double    y = i3 * x * x + i2 * x + i1    Pol = y    End Function`

This is the graphic which the programme drew This is what I want What should I do?

Edit: If you also say how I can make the program draw the graphic below, it will be awesome  I chose x1,y1 randomly to tell what I want to make

Thanks  Reply With Quote

2. ## Re: drawing the function graphic

@_MeRKeZ_
Try to change ymin and ymax to
vb Code:
`Const ymin As Integer = -60Const ymax As Integer = 60`

@Nightwalker83
Because the drawing is in Form_Load event, the draw is disappear when showing the form, add Me.AutoRedraw = True at the beginning of the Form_Load code.  Reply With Quote

3. ## Re: drawing the function graphic Originally Posted by 4x2y @Nightwalker83
Because the drawing is in Form_Load event, the draw is disappear when showing the form, add Me.AutoRedraw = True at the beginning of the Form_Load code.
Yeah, I noticed that after I posted.  Reply With Quote

4. ## Re: drawing the function graphic

Thanks for helping me

Why 0 and 121 cause that problem? Could you explain it?

Can I make the programme draw last graphic?  Reply With Quote

5. ## Re: drawing the function graphic Originally Posted by _MeRKeZ_ Thanks for helping me

Why 0 and 121 cause that problem? Could you explain it?
Because you are divide the plan to four quarters and at the same time you set xmin, xmax to -10, 10 so y should be the same.  Reply With Quote

6. ## Re: drawing the function graphic Originally Posted by _MeRKeZ_ Can I make the programme draw last graphic?
Are you want to draw lines according to x1 and y1? if so, try this
vb Code:
```Private Sub Command1_Click()
Dim x1 As Double
Dim y1 As Double

x1 = -5.6
y1 = 21

Line (x1, 0)-(x1, y1)
Line (0, y1)-(x1, y1)
End Sub```  Reply With Quote

7. ## Re: drawing the function graphic

I want those values to seem on the graphic as I gave the example above  Reply With Quote

draw, function #### Posting Permissions

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