Anticipation
Member
- Joined
- Jul 15, 2008
- Messages
- 10
- Programming Experience
- Beginner
Hi,
I'm using the code
(With XPrev, YPrev, XCur, YCur all being declared earlier in the code) To draw lines on a picturebox when the mouse is Clicked, and released. The problem is, that it only draws one line, and then when i go to draw another, the old one dissapears. I presume this is because i'm using the same integer variables in all of them.
My question is this; How would i be able to draw more than one line with the same variables ?
Thanks
I'm using the code
VB.NET:
Sub PicCanvasMouseDown(sender As Object, e As MouseEventArgs)
XPrev = e.X
YPrev = e.Y
End Sub
Public Sub PicCanvasMouseUp(sender As Object, e As MouseEventArgs)
XCur = e.X
YCur = e.Y
End Sub
Public Sub PicCanvasPaint(sender As Object, e As PaintEventArgs)
Dim p As New Pen(PenColour, PenWidth)
Dim g As Graphics = e.Graphics
g.DrawLine(p, XPrev, YPrev, XCur, YCur)
PicCanvas.Invalidate()
End Sub
My question is this; How would i be able to draw more than one line with the same variables ?
Thanks