C# 使用二维图形c创建足球#
我试着在球内和球内制作这个,但我不知道如何用我创建的GraphiPath填充球C# 使用二维图形c创建足球#,c#,polygon,C#,Polygon,我试着在球内和球内制作这个,但我不知道如何用我创建的GraphiPath填充球 private void soccerball_Paint(object sender, PaintEventArgs e) { Graphics soccerballg = e.Graphics; GraphicsPath hexagon = new GraphicsPath(); Pen pen = new Pen(Color.Red, 2); SolidBrush brush =
private void soccerball_Paint(object sender, PaintEventArgs e)
{
Graphics soccerballg = e.Graphics;
GraphicsPath hexagon = new GraphicsPath();
Pen pen = new Pen(Color.Red, 2);
SolidBrush brush = new SolidBrush(Color.Black);
Point[] points = new Point[]{
new Point(100,100),
new Point(108,100),
new Point(114,106),
new Point(108,112),
new Point(100,112),
new Point(94,106)
};
hexagon.AddPolygon(points);
Rectangle rect = new Rectangle(100, 100, 250, 250);
hexagon.AddEllipse(rect);
soccerballg.DrawPath(pen, hexagon);
soccerballg.FillRectangle(interior, rect);
}
要用使用相对于球中心的坐标的线填充球吗?如果球正在旋转,则可能需要使用旋转矩阵。翻译更容易。你有什么厌倦了吗?谢谢你的评论。我确实没有为薪水而做这件事,因为那已经过去了。我只是在球的内部创造了很多线,把它做成了一个足球,然后把它卖掉了。但我从来没有对结果感到满意,现在我正在等待另一个问题的解决。我必须说,我对自己的表现感到震惊还是不能解决这个问题毕竟我做到了哈哈,没关系。首先,我们只需要一个图形形状,六边形和矩形都是它的addpath,但它也不起作用,所以我想如果我们能给GraphicPath加上圆形的轮廓边框,然后用for重复六边形,谢谢