我正在试图将多边形列表绘制到图像框中。 目前我只得到了屏幕左上角的对角黑线。 这些点如下:
20,20 0,20 20,0 40,40
200,100 0,20 20,0 20,20
100, 200 0, 200 200,0 250, 450
150,130 1,20 20,0 10,20
private void pictureBox1_Paint_1(object sender, PaintEventArgs e)
{
int jobIndex = 0;
int trussIndex = 0;
Graphics g = e.Graphics;
foreach (Member m in jobArray[jobIndex].trusses[trussIndex].members)
{
Point[] pointArray = new Point[m.poly.Points.Count()];
//m.poly.Points.CopyTo(pointArray, 0);
int index =0;
foreach(System.Windows.Point p in m.poly.Points)
{
pointArray[index].X = (int)p.X;
pointArray[index].Y = (int)p.Y;
index++;
}
Pen myPen = new Pen(Color.Black);
SolidBrush myBrush = new SolidBrush(m.color);
g.DrawPolygon(myPen, pointArray);
g.FillPolygon(myBrush, pointArray);
}
}
Any Ideas as to why the polygons do not appear on the imagebox? The colors are no the issue nor the size of the box