Drawing Line and Append

Hi, i have a question, how do I draw a line from user input points(means I can add a line when ever I want without hardcoded in canvas.paint) eg, X,Y, etc… and add another continuous line to it. I am making a path using the lines added. And I dont want my canvas size to be restricted as I dont know how big the size will be. As I am making a visual mapping path. Is there a simple tutorial? I seen the MyPicture example but It seems incomplete.

what part are you having trouble with?
Make an array of points, and draw lines from the end of the previous one to the start of the next, and so on.


will give you a line that looks like this

0,0 to 50,50
50,50 to 100,50
and so on.

Right now i can only do that with g.Drawline(x1,y1,x2,y2) in the Canvas.Paint.

What i need is to call that function out of the Canvas.Paint .

Eg A button will draw a line with the parameteres of my choosing.

you can draw the lines on a picture that you create in code, and draw the picture into the canvas when the paint event is called.
Or you can simply keep adding points, and call the canvas.invalidate method

you could create a subclass of canvas that has a property which is a group2d
add your lines to that , and in the paint event, just draw the group2d object into the graphics