來自其他帖子的引用:初始化100點陣列
請致電Graphics.FillPolygon()
。你需要一個刷,而不是一支筆,你必須把你點到一個點從MSDN array Point[].
的示例代碼是這樣的:
// Create solid brush.
SolidBrush^ blueBrush = gcnew SolidBrush(Color::Blue);
// Create points that define polygon.
Point point1 = Point(50,50);
Point point2 = Point(100,25);
Point point3 = Point(200,5);
Point point4 = Point(250,50);
Point point5 = Point(300,100);
Point point6 = Point(350,200);
Point point7 = Point(250,250);
array<Point>^ curvePoints = {point1,point2,point3,point4,point5,point6,point7};
這是可怕的!我必須輸入一百個等距點!
將多邊形繪製到屏幕上。
e->Graphics->FillPolygon(blueBrush, curvePoints);
我已經嘗試了很多東西:
array<Point,2>^ aPoints;
//Points tabPoints[10][10];//= new Points[10][10];
Points = gcnew array<Point,2>(10,10);
//init des tableaux
for (int i = 0;i<10;i++)
{
for(int j =0;j<10;j++)
{
//tabPoints[i][j].pX =i*10;
//tabPoints[i][j].pY = j * 10;
// = new Points(i*10,j*10);
aPoints[i,j]= new Point(i*20,j*20);
}
}
他們沒有工作!
問題是? ... – GolezTrol
_Really?_如何在C++/CLI中創建100點數組? – Sassinak
擺脫循環內的'new'。你想要一個'Point'值,而不是指向一個的指針。 (MSDN有這個權利) –