Am totally clueless with this graphics drawing thing. All i am trying to do is get a simple line chart drawn, adding new values to the chart on a timer event. Now I know how to draw a single line in a picturebox when the form starts up.
Private Sub xyGraph_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles xyGraph.Paint
Dim pn As Pen = New Pen(Color.Green, 2)
Dim pt1 As Point = New Point(0, 0)
Dim pt2 As Point = New Point(140, 100)
e.Graphics.DrawLine(pn, pt1, pt2)
End Sub
This so far works. But I haven't a clue how to keep firing this event and add new lines to the picturebox.
If there's any tutorials or advice out there it would be great. If I use some 3rd party charting control, I'll never learn anything.

Newbie Ques: Simple Line Chart
Paul Bleisch
For example, I have a form with a bunch of radio buttons, text boxes, progress bars, picture box, etc....
I want to draw a filled circle and be able to move it around on top of the controls. Right now I'm using a transparent form. Can I just draw on top of controls by overriding the Paint event in the main form (with the controls)
jan schlagenhauf
If I wanted to create an updated line chart, I would:
Create a usercontrol LineChart.
have an array of lines you want to draw.
OnPaint: draw all the lines.
have a method AddLine(line)
In AddLine, invalidate the control
you won't need a timer since the control will always redisplay when lines are added.
good luck. any questions
Spiral401
le_mo_mo
The trick you are using now is probably ok. Another option might be to make a custom control that is added to the form, brought to the front, draws your image on its own surface, and then follows the mouse around by changing its position. The control would appear over the other controls on the form because it has been brought to the front of the zorder.
raja.raj.raja
detrius67
You also don't have to create a user control. You can continue to use the Paint event of the picture box if you like.
You just need to create a collection to hold the lines to be drawn (an ArrayList for example). Your paint function could just clear the picture box and then enumerate the ArrayList and draw every line it contains. Then you can have other code which modifies (adds or removes lines) the ArrayList and then calls Invalidate() on the picture box.
Mike Gold
Joe
Nbell
Good luck to both of you!!