我正在尝试绘制图片框,我的代码如下:
List<IntPoint> edgePoints;
List<IntPoint> corners;
AForge.Imaging.Blob[] blobs = blobCounter.GetObjectsInformation();
Graphics g = Graphics.FromImage(pictureBox2.Image);
Pen bluePen = new Pen(Color.Blue, 5);
double[] blobAdjustedSize = new double[blobs.Length];
for (int i = 0, n = blobs.Length; i < n; i++)
{
edgePoints = blobCounter.GetBlobsEdgePoints(blobs[i]);
corners = PointsCloud.FindQuadrilateralCorners(edgePoints);
g.DrawPolygon(bluePen, corners); // **UNDERLINE**
}
我收到了一个错误。 g.DrawPolygon(bluePen, corners)
有下划线。
错误是:
System.Drawing.Graphics.DrawPolygon(System.Drawing.Pen,System.Drawing.Point [])的最佳重载方法匹配“有一些无效的参数
答案 0 :(得分:1)
它期待Array of Points而不是列表,将角定义为Array或添加
using System.Linq;
到文件顶部,然后将行更改为
g.DrawPolygon( bluePen, corners.ToArray());