![]() |
| ||
| Drawing Multiple Lines I'm using the code Sub PicCanvasMouseDown(sender As Object, e As MouseEventArgs)To draw a line on a PictureBox. It works fine, until you go to draw another line, when the first line dissapears, i presume this is because i'm using the same integer variables for each one (XPrev, YPrev, XCur, YCur.) How would i be able to use the same integer variables, but be able to draw more than one line ? |
| ||
| Re: Drawing Multiple Lines Hi, > Save the All lines Points (Make a class Line Has X and Y member and Save it in an ArrayList) > Draw All the Lines (ArrayList) in Paint Event |
| ||
| Re: Drawing Multiple Lines That's not really what i meant. I'm capturing the points on mouse up and down, and that works, but only for one line. i want to be able to keep that line on the picturebox, and draw another, using the same variables for capturing. |
| ||
| Re: Drawing Multiple Lines Yes, I am also meant the same thing. To draw all the lines you need to store it. so you should have an ArrayList or some other dynamic data structure. ArrayList can have any object. so you need to group your Line into a class like Public Class Line Then create a new Line object whenever you draw line. Sub PicCanvasMouseUp(sender As Object, e As MouseEventArgs)To repaint, Iterate through the ArrayList and Draw all the Lines in the ArrayList. Sub PicCanvasPaint(sender As Object, e As PaintEventArgs)This is what i meant. |
| All times are GMT -4. The time now is 9:59 pm. |
Forum system based on vBulletin Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
©2003 - 2010 DaniWeb® LLC