I have this code for drawing a path.
l1 is a Label. When I call this it draws the path fine, but when I call it again it draws another path but doesn't get rid of the first path.Code:Dim map As New Bitmap(l1.Size.Width, l1.Size.Height, l1.CreateGraphics) Dim nextPoint As Point Using g As Drawing.Graphics = Graphics.FromImage(map) Dim dPath As New Drawing2D.GraphicsPath For i As Integer = 0 To path.Count - 1 Try nextPoint = path(i + 1) Catch End Try dPath.AddLine(path(i).X * 12 + xMod, _ path(i).Y * 13 + yMod, _ nextPoint.X * 12 + xMod, _ nextPoint.Y * 13 + yMod) Next l1.CreateGraphics.DrawPath(Drawing.Pens.Black, dPath) End Using
Basically, I only want one path on the Label at a time.




Reply With Quote