来源:http://www.cnblogs.com/kiny/articles/2508133.html,画扇形的用法和画弧线的用法是一样的。
DrawPie(Pen pen, Rectangle rect, float startAngle, float sweepAngle) DrawPie(Pen pen, RectangleF rect, float startAngle, float sweepAngle) DrawPie(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle) DrawPie(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
private void Form1_Paint(object sender, PaintEventArgs e) { //创建画板从Paint事件中的直接引用Graphics对象 Graphics graphics = e.Graphics; graphics.Clear(Color.Black); //定义画笔 Pen penWhite = new Pen(Color.White, 3.0f); Pen penRed = new Pen(Color.Red, 3.0f); Pen penGreen = new Pen(Color.Green, 3.0f); //定义扇形所属椭圆的矩形 Rectangle rect = new Rectangle(100, 100, 400, 200); graphics.DrawRectangle(penWhite, 100, 100, 400, 200);//矩形 graphics.DrawEllipse(penWhite, rect);//椭圆 graphics.DrawPie(penRed, rect, -60, -60);//扇形 graphics.DrawArc(penGreen, rect, 0, 90);//弧线 }