using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ChineseFlag
{
public partial class FormMain : Form
{
public FormMain()
{
InitializeComponent();
}
private void FormMain_Load(object sender, EventArgs e)
{
PaintFlag();
}
//修改窗体大小时发生
private void FormMain_Resize(object sender, EventArgs e)
{
PaintFlag();
}
/// <summary>
/// 在图片框 picFlagOfChina 中绘制国旗
/// </summary>
private void PaintFlag()
{
picFlagOfChina.BackColor = Color.Red;
picFlagOfChina.Image = new Bitmap(
picFlagOfChina.Width, picFlagOfChina.Height);
Graphics g = Graphics.FromImage(picFlagOfChina.Image);
Point[] p = new Point[] { };
p = PentacleA(this.Width, this.Height);
g.FillPolygon(Brushes.Yellow, p);
p = PentacleB(this.Width, this.Height);
g.FillPolygon(Brushes.Yellow, p);
p = PentacleC(this.Width, this.Height);
g.FillPolygon(Brushes.Yellow, p);
p = PentacleD(this.Width, this.Height);
g.FillPolygon(Brushes.Yellow, p);
p = PentacleE(this.Width, this.Height);
g.FillPolygon(Brushes.Yellow, p);
}
//大星
private Point[] PentacleA(int width, int height)
{
return new Point[]
{
new Point((int)(width / 30.0 * 5), (int)(height / 20.0 * 2)),
new Point((int)(width / 30.0 * 5.7), (int)(height / 20.0 * 4.1)),
new Point((int)(width / 30.0 * 8), (int)(height / 20.0 * 4.1)),
new Point((int)(width / 30.0 * 6), (int)(height / 20.0 * 5.3)),
new Point((int)(width / 30.0 * 6.8), (int)(height / 20.0 * 7.3)),
new Point((int)(width / 30.0 * 5), (int)(height / 20.0 * 6.1)),
new Point((int)(width / 30.0 * 3.2), (int)(height / 20.0 * 7.3)),
new Point((int)(width / 30.0 * 4), (int)(height / 20.0 * 5.3)),
new Point((int)(width / 30.0 * 2), (int)(height / 20.0 * 4.1)),
new Point((int)(width / 30.0 * 4.3), (int)(height / 20.0 * 4.1)),
};
}
//工人星
private Point[] PentacleB(int width, int height)
{
return new Point[]
{
new Point((int)(width / 30.0 * 9.2), (int)(height / 20.0 * 2.5)),
new Point((int)(width / 30.0 * 9.6), (int)(height / 20.0 * 2)),
new Point((int)(width / 30.0 * 9.3), (int)(height / 20.0 * 1.4)),
new Point((int)(width / 30.0 * 9.95), (int)(height / 20.0 * 1.7)),
new Point((int)(width / 30.0 * 10.45), (int)(height / 20.0 * 1.1)),
new Point((int)(width / 30.0 * 10.36), (int)(height / 20.0 * 1.85)),
new Point((int)(width / 30.0 * 11), (int)(height / 20.0 * 2.1)),
new Point((int)(width / 30.0 * 10.34), (int)(height / 20.0 * 2.25)),
new Point((int)(width / 30.0 * 10.3), (int)(height / 20.0 * 2.95)),
new Point((int)(width / 30.0 * 9.9), (int)(height / 20.0 * 2.3))
};
}
//农民星
private Point[] PentacleC(int width, int height)
{
return new Point[]
{
new Point((int)(width / 30.0 * 11), (int)(height / 20.0 * 4.1)),
new Point((int)(width / 30.0 * 11.65), (int)(height / 20.0 * 3.8)),
new Point((int)(width / 30.0 * 11.55), (int)(height / 20.0 * 3.05)),
new Point((int)(width / 30.0 * 12.05), (int)(height / 20.0 * 3.6)),
new Point((int)(width / 30.0 * 12.7), (int)(height / 20.0 * 3.3)),
new Point((int)(width / 30.0 * 12.35), (int)(height / 20.0 * 3.98)),
new Point((int)(width / 30.0 * 12.9), (int)(height / 20.0 * 4.5)),
new Point((int)(width / 30.0 * 12.1), (int)(height / 20.0 * 4.3)),
new Point((int)(width / 30.0 * 11.8), (int)(height / 20.0 * 5)),
new Point((int)(width / 30.0 * 11.7), (int)(height / 20.0 * 4.2))
};
}
//小资星
private Point[] PentacleD(int width, int height)
{
return new Point[]
{
new Point((int)(width / 30.0 * 11.1), (int)(height / 20.0 * 6.7)),
new Point((int)(width / 30.0 * 11.8), (int)(height / 20.0 * 6.7)),
new Point((int)(width / 30.0 * 12), (int)(height / 20.0 * 6)),
new Point((int)(width / 30.0 * 12.2), (int)(height / 20.0 * 6.7)),
new Point((int)(width / 30.0 * 12.9), (int)(height / 20.0 * 6.7)),
new Point((int)(width / 30.0 * 12.35), (int)(height / 20.0 * 7.1)),
new Point((int)(width / 30.0 * 12.55), (int)(height / 20.0 * 7.8)),
new Point((int)(width / 30.0 * 12), (int)(height / 20.0 * 7.4)),
new Point((int)(width / 30.0 * 11.45), (int)(height / 20.0 * 7.8)),
new Point((int)(width / 30.0 * 11.65), (int)(height / 20.0 * 7.1))
};
}
//民资星(工人星向下平移7个单位)
private Point[] PentacleE(int width, int height)
{
return new Point[]
{
new Point((int)(width / 30.0 * 9.2), (int)(height / 20.0 * 9.5)),
new Point((int)(width / 30.0 * 9.6), (int)(height / 20.0 * 9)),
new Point((int)(width / 30.0 * 9.3), (int)(height / 20.0 * 8.4)),
new Point((int)(width / 30.0 * 9.95), (int)(height / 20.0 * 8.7)),
new Point((int)(width / 30.0 * 10.45), (int)(height / 20.0 * 8.1)),
new Point((int)(width / 30.0 * 10.36), (int)(height / 20.0 * 8.85)),
new Point((int)(width / 30.0 * 11), (int)(height / 20.0 * 9.1)),
new Point((int)(width / 30.0 * 10.34), (int)(height / 20.0 * 9.25)),
new Point((int)(width / 30.0 * 10.3), (int)(height / 20.0 * 9.95)),
new Point((int)(width / 30.0 * 9.9), (int)(height / 20.0 * 9.3))
};
}
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有