Here’s an example of how to draw pentagons with C#.

``````//http://mathworld.wolfram.com/Pentagon.html
namespace M1
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;

public static class Program
{
#region Constants

private static readonly double C1 = 0.25d * (Math.Sqrt(5d) - 1d);
private static readonly double C2 = 0.25d * (Math.Sqrt(5d) + 1d);
private static readonly byte[] PentagonPathPointTypes = { 0, 1, 1, 1, 129 };
private static readonly double S1 = 0.25d * Math.Sqrt(10d + 2d * Math.Sqrt(5d));
private static readonly double S2 = 0.25d * Math.Sqrt(10d - 2d * Math.Sqrt(5d));

#endregion Constants

#region Methods

private static GraphicsPath CreatePentagon(PointF center, float radius)
{
var s1 = S1 * radius;
var s2 = S2 * radius;
var c1 = C1 * radius;
var c2 = C2 * radius;
var point0 = new PointF(center.X, center.Y - radius);
var point1 = new PointF((float)(center.X + s1), (float)(center.Y - c1));
var point2 = new PointF((float)(center.X + s2), (float)(center.Y + c2));
var point3 = new PointF((float)(center.X - s2), (float)(center.Y + c2));
var point4 = new PointF((float)(center.X - s1), (float)(center.Y - c1));
var pts = new[] { point0, point1, point2, point3, point4 };
return new GraphicsPath(pts, PentagonPathPointTypes);
}

#endregion Methods

private static void Main(string[] args)
{
using (var bitmap = new Bitmap(1000, 1000))
{
using (var graphics = Graphics.FromImage(bitmap))
{
graphics.Clear(Color.White);
graphics.SmoothingMode = SmoothingMode.HighQuality;
var center = new PointF(bitmap.Width / 2, bitmap.Height / 2);