Adds an arc representing a segment of an ellipse.
Syntax

[C#]

void AddArc(double x, double y, double width, double height, double startAngle, double sweepAngle);
void AddArc(RectangleF rect, double startAngle, double sweepAngle);

[Visual Basic]

Sub AddArc(x As Double, y As Double, width As Double, height As Double, startAngle As Double, sweepAngle As Double)
Sub AddArc(rect As RectangleF, startAngle As Double, sweepAngle As Double)
Params
Name Description
x The left coordinate of the bounding rectangle.
y The top coordinate of the bounding rectangle.
width The width of the bounding rectangle.
height The height of the bounding rectangle.
startAngle Angle from the x-axis to the start of the arc section. Angles are measured in degrees going clockwise from the x axis.
sweepAngle Angle from the start of the arc section to the end of it. Angles are measured in degrees going clockwise.
rect The bounding rectangle.
Notes

None.

Example

[C#]using (Bitmap bm = new Bitmap(600, 600)) {
  using (Graphics graphics = Graphics.FromImage(bm)) {
    RectangleF rect = bm.Bounds;
    rect.Inflate(-50, -50);
    GraphicsPath arc = new GraphicsPath();
    arc.AddArc(rect, 135, 270);
    Pen pen = new Pen(Color.Green, 20);
    pen.StartCap = LineCap.OpenArrowAnchor;
    pen.EndCap = LineCap.OpenArrowAnchor;
    graphics.DrawPath(pen, arc);
  }
  bm.Save(Server.MapPath("IG8_GraphicsPath_DrawPath.png"));
}


The code here draws an arc into a GraphicsPath. We then draw the arc onto a Bitmap providing arrows at either end. The final output is shown below.


IG8_GraphicsPath_DrawPath.png