using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
var g = pictureBox1.CreateGraphics();
var pen = new Pen(Color.White);
var red = new Pen(Color.Red);
Point pt0 = new Point(30, 30);
float width = 30;
float x3 = (float)(pt0.X + width * 8.75);
float y3 = (float)(pt0.Y + width * 4);
float r3, r4;
r3 = (float)(width);
r4 = (float)(2.5 * width);
float[,] Out = new float[14, 2];
float[,] In = new float[14, 2];
float x0, y0, x1, y1;
float r0, r1;
x0 = (float)(pt0.X + 5.75 * width);
y0 = (float)(pt0.Y + width * 4);
r0 = (float)(3 * width);
x1 = (float)(pt0.X + width * 6.42);
y1 = (float)(pt0.Y + width * 4);
r1 = (float)(2.63 * width);
g.Clear(Color.White);
var brush = new SolidBrush(Color.Red);
g.DrawRectangle(pen, pt0.X, pt0.Y, width * 28, width * 14);
for (int line = 0; line < 7; line++)
{
int i = 0;
for (; i < 14; i++)
{
g.FillRectangle(brush, i * 2 * width + width + pt0.X, 2 * line * width + pt0.Y, width, width);
}
for (i = 0; i < 14; i++)
{
g.FillRectangle(brush, i * 2 * width + pt0.X, 2 * line * width + pt0.Y, width, width);
}
}
brush.Color = Color.Blue;
g.FillRectangle(brush, 30, 30, 420, 240);
g.FillEllipse(new SolidBrush(Color.Yellow), x0 - r0, y0 - r0, 2 * r0, 2 * r0);
g.FillEllipse(new SolidBrush(Color.Blue), x1 - r1, y1 - r1, 2 * r1, 2 * r1);
for (int i = 0; i < 14; i++)
{
Out[i, 0] = (float)Math.Cos(2 * Math.PI + i * 2 * Math.PI / 14 + 2 * Math.PI / 14 * 3) * r3 + x3;
Out[i, 1] = (float)Math.Sin(2 * Math.PI + i * 2 * Math.PI / 14 + 2 * Math.PI / 14 * 3) * r3 + y3;
In[i, 0] = (float)Math.Cos(2 * Math.PI + Math.PI / 2 + i * 2 * Math.PI / 14) * r4 + x3;
In[i, 1] = (float)Math.Sin(2 * Math.PI + Math.PI / 2 + i * 2 * Math.PI / 14) * r4 + y3;
}
PointF[] point = new PointF[28];
for (int i = 0; i < 14; i++)
{
point[i * 2] = new PointF(Out[i, 0], Out[i, 1]);
}
for (int i = 0; i < 14; i++)
{
point[i * 2 + 1] = new PointF(In[i, 0], In[i, 1]);
}
g.FillPolygon(new SolidBrush(Color.Yellow), point);
}
}
}