6.使用GDI+画扇形

     来源: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);//弧线
        }

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值