Start by finding all the places where you are doing canvas1.graphics.drawpicture or similar , and replace them with canvas1.invalidate
inside the canvas1.paint event, draw everything
Draw the lines, text, etc
you may need to have pictures and object2d items as properties of the window in order to get at them from inside the paint event.
Or you may create a canvas subclass that has properties such as thePicture, theText, theArrayOfLines()
and in the paint event draw them to the g object you are passed.