巴基斯坦国旗
巴基斯坦国旗呈长方形,长与宽之比为3:2。左侧是白色竖长方形,宽度占整个旗面的1/4;右侧为深绿色长方形,中央有一颗白色五角星和一弯白色新月。白色象征和平,代表国内信奉印度教、佛教、基督教、祆教的居民和其他少数民族;绿色象征繁荣,还代表伊斯兰教。新月象征进步,五角星象征光明;新月和五角星还象征对伊斯兰教的信仰。
两个圆弧圆心和五角星中心都在同一条对角线上。
CAD图片:
核心代码:
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 ceshi1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
var g = this.pictureBox1.CreateGraphics();
SolidBrush whiteBrush = new SolidBrush(Color.White);
SolidBrush greenBrush = new SolidBrush(Color.Green);
Point point1 = new Point(20, 20);
Point point2 = new Point(140, 20);
Point point3 = new Point(500, 20);
Point point4 = new Point(20, 340);
Point point5 = new Point(140, 340);
Point point6 = new Point(500, 340);
Point[] points1 = { point5, point4, point1, point2 };
Point[] points2 = { point6, point5, point2, point3 };
g.FillPolygon(whiteBrush, points1, System.Drawing.Drawing2D.FillMode.Alternate);
g.FillPolygon(greenBrush, points2, System.Drawing.Drawing2D.FillMode.Alternate);//基本形状
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
Brush bush = new SolidBrush(Color.White);
g.FillEllipse(bush, 248, 123, 136, 136);
Brush blackbush = new SolidBrush(Color.Green);
g.FillEllipse(blackbush, 273, 118, 116, 116);
int R = 23;
const double PI = Math.PI;
double ct1 = PI / 10.0;
var pen = new Pen(Color.White);
var brush = new SolidBrush(Color.White);
Point pt0 = new Point(345, 155);
Point[] pts = new Point[10];
double dct = PI / 5.0;
double ct2 = 3 * PI / 5.0 - ct1;
double r = R * Math.Cos(4 * Math.PI / 10.0) / Math.Cos(2 * Math.PI / 10.0);
int i = 0;
for (i = 0; i < 9; i += 2)
{
pts[i].X = (int)Math.Round(pt0.X + R * Math.Cos(PI / 7 + ct1 + i * dct));
pts[i].Y = (int)Math.Round(pt0.Y - R * Math.Sin(PI / 7 + ct1 + i * dct));
}
for (i = 1; i < 10; i += 2)
{
pts[i].X = (int)Math.Round(pt0.X + r * Math.Cos(PI / 7 + ct1 + i * dct));
pts[i].Y = (int)Math.Round(pt0.Y - r * Math.Sin(PI / 7 + ct1 + i * dct));
}
g.FillPolygon(brush, pts);
}
}
}
效果图片: