You don't need a
List<string>
, but rather a
List<Point>
. This would moreover avoid the use of an array and its redim method (which is costly).
Suggested modification:
Dim CoOrds As New List(Of Point)
Dim x, y As Integer
If (Int32.TryParse(txt_Add_Point_X.Text, x) AndAlso Int32.TryParse(txt_Add_Point_Y.Text, y))
CoOrds.Add(new Point(x, y))
End If
Private Sub but_Draw_Click(sender As System.Object, e As System.EventArgs) Handles but_Draw.Click
Dim myGraphics As Graphics = Panel1.CreateGraphics
myGraphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
myGraphics.DrawPolygon(Pens.DarkRed, CoOrds.ToArray())
End Sub
Hope this helps.