double[] xAngle = new double[12];
double[] yAngle = new double[12];
double angleIncrement = (endAngle - startAngle) / 10;
double angle = startAngle;
for (int i = 0; i <= 10; i++) {
xAngle[i] = x + (Math.Cos(angle * (Math.PI / 180)) * (width /2));
yAngle[i] = y + (Math.Sin(angle * (Math.PI / 180)) * (height / 2));
angle += angleIncrement;
}
xAngle[11] = x + (Math.Cos(endAngle * (Math.PI / 180)) * (width / 2));
yAngle[11] = y + (Math.Sin(endAngle * (Math.PI / 180)) * (height /2));
Point[] anglePoints = {
new Point(x, y),
new Point((int)xAngle[0], (int)yAngle[0]),
new Point((int)xAngle[1], (int)yAngle[1]),
new Point((int)xAngle[2], (int)yAngle[2]),
new Point((int)xAngle[3], (int)yAngle[3]),
new Point((int)xAngle[4], (int)yAngle[4]),
new Point((int)xAngle[5], (int)yAngle[5]),
new Point((int)xAngle[6], (int)yAngle[6]),
new Point((int)xAngle[7], (int)yAngle[7]),
new Point((int)xAngle[8], (int)yAngle[8]),
new Point((int)xAngle[9], (int)yAngle[9]),
new Point((int)xAngle[10], (int)yAngle[10]),
new Point((int)xAngle[11], (int)yAngle[11])
};
g.DrawPolygon(pen, anglePoints);
}
private void Form1_Paint(object sender, PaintEventArgs e) {
// Выводим несколько секторов на экран