目前我正在尝试绘制一个带有图形的五边形,但由于我无法获得积分而无法获得。到目前为止,我已经尝试绘制一个我成功的三角形,代码如下;
SolidBrush sb = new SolidBrush(painting);
PointF point1 = new PointF(25, 350);
PointF point2 = new PointF(450, 350);
PointF point3 = new PointF(225, 50);
PointF[] curvePoints = { point1, point2, point3 };
g.FillPolygon(sb, curvePoints);
paintstart = false;
(使用三角形值作为基础)我想添加两个点(因为五边形有5个边),我的五边形代码就像这样
SolidBrush sb = new SolidBrush(painting);
PointF point1 = new PointF(25, 350);
PointF point2 = new PointF(450, 350);
PointF point3 = new PointF(225, 50);
PointF point4 = new PointF(10, 150);
PointF point5 = new Point(475, 150);
PointF[] curvePoints = { point1, point2, point3, point4,point5};
g.FillPolygon(sb, curvePoints);
paintstart = false;
添加第5点后,整个形状变形,第4点保持不变。
知道为什么在加上第5点后,整个形状会变形吗?我将+15值加到五边形基底(450)的x值上,y轴保持不变。
感谢任何帮助!
答案 0 :(得分:0)
当你有三个以上的积分时,积分的顺序很重要:
PointF[] curvePoints = { point1, point2, point5, point3, point4 };