绘制扇形

Posted on 2019-01-11 22:04  努力成长静待花开  阅读(378)  评论(0编辑  收藏  举报

实现效果:

  

知识运用:

  Graphics类中的DrawPie方法

  public void DrawPie (Pen pen,Rectangle rectangle, startAngle, float sweepAngle)

  public void DrawPie (Pen pen, int  x,int y int width ,int height, int startAngle ,int sweepAngle)

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            Graphics g = this.CreateGraphics();
            Pen myPen = new Pen(Color.Black,2);
            g.DrawPie(myPen,30,20,200,140,0,240);
        }