一、简介:
马来西亚国旗是 马来西亚 的 国旗 。 马来西亚国旗的旗地颜色是红白相间的十四道相等的横条。 靠旗杆一边的左上方为深蓝色长方形,上有一弯新月和颗十四个尖角的星 [1] 。 1957年8月31日,马来西亚国旗首次在吉隆坡正式升起。 1997年8月30日,时任总理马哈蒂尔将马国旗正式命名为“光辉条纹”旗 [3] 。 马来西亚的国旗呈横长方形,长与宽之比为2:1。 主体部分由14道红白相间、宽度相等的横条组成。 左上方有一深蓝色的长方形,上有一弯黄色新月和一颗14个尖角的黄色星 [4-5] 。 马来西亚国旗的14道红、白横条象征马来西亚的13个州和政府,新月象征马来西亚人民对伊斯兰教的信仰,14个尖角的太阳星象征马来西亚13个州和政府的团结。
二、数据测量:
三、代码编写:
namespace WinFormsApp5
{
public partial class Form1 : Form
{
Bitmap bitmap;
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);
}
}
}
四、运行结果: