我正在尝试将多边形列表绘制到图像框。到目前为止,我只在屏幕的左上角看到一条对角黑线。要点如下:
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);
}
}
关于为什么多边形没有出现在图像框上的任何想法?颜色不是问题,也不是盒子的大小