-
Jan 7th, 2012, 06:14 AM
#1
Thread Starter
Member
drawing the function graphic
Hi friends,
I want to ask a question about drawing a graphic
these are my code
vb Code:
Option Explicit Const i3 As Integer = 1 Const i2 As Integer = 2 Const i1 As Integer = 1 Const xmin As Integer = -10 Const xmax As Integer = 10 Const ymin As Integer = 0 Const ymax As Integer = 121 Const N As Integer = 20 Private Sub Form_Load() Dim i As Integer Dim 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
Last edited by _MeRKeZ_; Jan 7th, 2012 at 06:21 AM.
-
Jan 7th, 2012, 06:43 AM
#2
Re: drawing the function graphic
@_MeRKeZ_
Try to change ymin and ymax to
vb Code:
Const ymin As Integer = -60 Const 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.
-
Jan 7th, 2012, 07:11 AM
#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.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Jan 7th, 2012, 01:34 PM
#4
Thread Starter
Member
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?
-
Jan 8th, 2012, 08:03 AM
#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.
-
Jan 8th, 2012, 08:55 AM
#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
-
Jan 9th, 2012, 08:56 AM
#7
Thread Starter
Member
Re: drawing the function graphic
I want those values to seem on the graphic as I gave the example above
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|