none
How to draw this image using GDI+

    Question

  • Could you show me the way to draw following image by using GDI+? Thank you very much.

    Saturday, July 22, 2006 10:57 AM

Answers

  • You need to use the Graphics.DrawPie and Graphics.FillPie method to draw a pie.
    Here is a little example:


    public void FillPieInt(PaintEventArgs e)
    {

    // Create solid brush.
    SolidBrush redBrush = new SolidBrush(Color.Red);

    // Create location and size of ellipse.
    int x = 0;
    int y = 0;
    int width = 200;
    int height = 100;

    // Create start and sweep angles.
    int startAngle = 0;
    int sweepAngle = 45;

    // Fill pie to screen.
    e.Graphics.FillPie(redBrush, x, y, width, height, startAngle, sweepAngle);
    }

     


    Saturday, July 22, 2006 12:10 PM
    Moderator

All replies

  • You need to use the Graphics.DrawPie and Graphics.FillPie method to draw a pie.
    Here is a little example:


    public void FillPieInt(PaintEventArgs e)
    {

    // Create solid brush.
    SolidBrush redBrush = new SolidBrush(Color.Red);

    // Create location and size of ellipse.
    int x = 0;
    int y = 0;
    int width = 200;
    int height = 100;

    // Create start and sweep angles.
    int startAngle = 0;
    int sweepAngle = 45;

    // Fill pie to screen.
    e.Graphics.FillPie(redBrush, x, y, width, height, startAngle, sweepAngle);
    }

     


    Saturday, July 22, 2006 12:10 PM
    Moderator
  • Thank you very much. It works well.
    Saturday, July 22, 2006 1:25 PM