
using System.Drawing;
using System.Drawing.Drawing2D;
// 创建画布,这里的画布是由Form提供的。
Graphics graphics = this.CreateGraphics();
// 底色填充为灰色
Brush white = new SolidBrush(Color.Gray);
graphics.FillRectangle(white, new Rectangle(0, 0, 300, 300));
// 定义白色笔刷
Brush whiteBrush = new SolidBrush(Color.White);
// 定义黑色笔刷
Brush blackBrush = new SolidBrush(Color.Black);
//1、先绘制一个完整的白色实体圆
// 整个圆形填充白色
graphics.FillPie(whiteBrush, 0, 0, 300, 300, 0, 360);
// 定义路径
GraphicsPath blackPath = new GraphicsPath();
//2、绘制半黑半白。
// 右半圆黑色
blackPath.AddArc(0, 0, 300, 300, 90, -180);
//3、绘制一黑一白两个半圆
// 白色鱼头
blackPath.AddArc(75, 0, 150, 150, 90, -180);
// 黑色鱼头
blackPath.AddArc(75, 150, 150, 150, 90, 180);
// 填充
graphics.FillPath(blackBrush, blackPath);
//4、绘制两个小圆
// 填充黑色鱼眼
graphics.FillPie(blackBrush, new Rectangle(130, 50, 50, 50), 0, 360);
// 填充白色鱼眼
graphics.FillPie(whiteBrush, new Rectangle(130, 200, 50, 50), 0, 360);
// 设置文字
Font miFont = new Font("宋体", 20, FontStyle.Bold);
graphics.DrawString("白鱼", miFont, blackBrush, 65, 65);
graphics.DrawString("黑鱼", miFont, whiteBrush, 185, 215);
graphics.Dispose();