Hy Shyma
Sorry to jump in here, but that previous example is quite verbose and maybe a little confusing if you are new to GDI.
Here is a very simplified example (read not production code) of how you might approach this.
If you do need to support zoming, rotating, scrolling etc then you will need to look at the Matrix class and the previous example. I'd also recommend that you don't use lists in the final version as there is a lot of array resizing happening which you would want to avoid ... I used lists solely so that you can concentrate on the painting etc
Shout if you need any more information/help.
Richard
Public
Class PaintControlInherits ControlPrivate mAllPoints AsNew Generic.List(Of Generic.List(Of Point))Private mCurPoints As Generic.List(Of Point)ProtectedOverridesSub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)mCurPoints =
New Generic.List(Of Point)mAllPoints.Add(mCurPoints)
MyBase.OnMouseDown(e)EndSubProtectedOverridesSub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)MyBase.OnMouseMove(e)If mCurPoints IsNotNothingThenmCurPoints.Add(e.Location)
MyBase.Invalidate()EndIfEndSubProtectedOverridesSub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)mCurPoints =
NothingMyBase.OnMouseUp(e)EndSubProtectedOverridesSub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)MyBase.OnPaint(e)ForEach lst As Generic.List(Of Point) In mAllPointsIf lst.Count > 0 Then e.Graphics.DrawCurve(Pens.Black, lst.ToArray)NextEndSubEnd
Class