13,347
社区成员
发帖
与我相关
我的任务
分享
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Bitmap bmp = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(bmp);
GraphicsPath path1 = new GraphicsPath();
path1.AddArc(new Rectangle(0, 0, 100, 100), 0.0f, 90.0f);
path1.AddLine(new Point(50, 50), new Point(50, 100));
path1.AddLine(new Point(50, 50), new Point(100, 50));
g.FillPath(Brushes.Green, path1);
GraphicsPath path2 = new GraphicsPath();
path2.AddArc(new Rectangle(0, 0, 100, 100), 90.0f, 90.0f);
path2.AddLine(new Point(50, 50), new Point(0, 50));
path2.AddLine(new Point(50, 50), new Point(50, 100));
g.FillPath(Brushes.Black, path2);
GraphicsPath path3 = new GraphicsPath();
path3.AddArc(new Rectangle(0, 0, 100, 100), 180.0f, 90.0f);
path3.AddLine(new Point(50, 50), new Point(50, 0));
path3.AddLine(new Point(50, 50), new Point(0, 50));
g.FillPath(Brushes.Blue, path3);
GraphicsPath path4 = new GraphicsPath();
path4.AddArc(new Rectangle(0, 0, 100, 100), 270.0f, 90.0f);
path4.AddLine(new Point(50, 50), new Point(100, 50));
path4.AddLine(new Point(50, 50), new Point(50, 0));
g.FillPath(Brushes.Tomato, path4);
pictureBox1.Image = bmp;
}