--- title: "Ellipses and Arcs in GDI+" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "arcs" - "GDI+, arcs" - "drawing [Windows Forms], ellipses" - "GDI+, ellipses" - "ellipses" - "drawing [Windows Forms], arcs" ms.assetid: 34f35133-a835-4ca4-81f6-0dfedee8b683 --- # Ellipses and Arcs in GDI+ You can easily draw ellipses and arcs using the and methods of the class. ## Drawing an Ellipse To draw an ellipse, you need a object and a object. The object provides the method, and the object stores attributes, such as width and color, of the line used to render the ellipse. The object is passed as one of the arguments to the method. The remaining arguments passed to the method specify the bounding rectangle for the ellipse. The following illustration shows an ellipse along with its bounding rectangle. ![Ellipses and arcs](./media/aboutgdip02-art05.gif "Aboutgdip02_art05") The following example draws an ellipse; the bounding rectangle has a width of 80, a height of 40, and an upper-left corner of (100, 50): [!code-csharp[LinesCurvesAndShapes#51](~/samples/snippets/csharp/VS_Snippets_Winforms/LinesCurvesAndShapes/CS/Class1.cs#51)] [!code-vb[LinesCurvesAndShapes#51](~/samples/snippets/visualbasic/VS_Snippets_Winforms/LinesCurvesAndShapes/VB/Class1.vb#51)] is an overloaded method of the class, so there are several ways you can supply it with arguments. For example, you can construct a and pass the to the method as an argument: [!code-csharp[LinesCurvesAndShapes#52](~/samples/snippets/csharp/VS_Snippets_Winforms/LinesCurvesAndShapes/CS/Class1.cs#52)] [!code-vb[LinesCurvesAndShapes#52](~/samples/snippets/visualbasic/VS_Snippets_Winforms/LinesCurvesAndShapes/VB/Class1.vb#52)] ## Drawing an Arc An arc is a portion of an ellipse. To draw an arc, you call the method of the class. The parameters of the method are the same as the parameters of the method, except that requires a starting angle and sweep angle. The following example draws an arc with a starting angle of 30 degrees and a sweep angle of 180 degrees: [!code-csharp[LinesCurvesAndShapes#53](~/samples/snippets/csharp/VS_Snippets_Winforms/LinesCurvesAndShapes/CS/Class1.cs#53)] [!code-vb[LinesCurvesAndShapes#53](~/samples/snippets/visualbasic/VS_Snippets_Winforms/LinesCurvesAndShapes/VB/Class1.vb#53)] The following illustration shows the arc, the ellipse, and the bounding rectangle. ![Ellipses and arcs](./media/aboutgdip02-art06.gif "Aboutgdip02_art06") ## See also - - - [Lines, Curves, and Shapes](lines-curves-and-shapes.md) - [How to: Create Graphics Objects for Drawing](how-to-create-graphics-objects-for-drawing.md) - [How to: Create a Pen](how-to-create-a-pen.md) - [How to: Draw an Outlined Shape](how-to-draw-an-outlined-shape.md)