2014-06-12 54 views
0

畫我想畫的圖片框和我的代碼如下:座標上PictureBox的Image

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

錯誤提到它。您沒有提供更正參數。 – Guanxi

回答

1

該公司預計的Array of Points,而不是一個列表,定義邊角爲Array或添加

using System.Linq; 

到文件的頂部,並將該行更改爲

g.DrawPolygon(bluePen, corners.ToArray()); 
+0

我試過但沒有工作。 :/ – user3425879

+0

以何種方式不起作用? – Rich

+0

相同的錯誤,同一行下劃線 – user3425879