I want to read a file, each line of which contains the coorindates of a
polygon, and then display those polygons. I the values in each line in
invValues[200][200].
Following is part of my code:
ArrayList points=new ArrayList();
for(int j=0;j<jj;j++)
{
for(int i=0;i<size[j];i+=2)
points.Add(new Point(intValues[j,i],intValues[j,i+1]));
points.TrimToSize();
Point[] pointArray=(Point[])points.ToArray(
points[0].GetType());
g.DrawPolygon( pen, pointArray);
//points.Clear();
}
With this code all the polygons are linked together. I tried
'points.Clear()' to clear out the ArrayList after drawing each polygon, but
that caused a 'System.ArgumentOutOfRangeException'.
What am I missing? How can I fix my program?