Graphics.DrawEllipse Method
Draws an ellipse defined by a bounding rectangle specified by a pair of coordinates, a height, and a width.
Overload List
Draws an ellipse specified by a bounding Rectangle structure.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Sub DrawEllipse(Pen, Rectangle)
[C#] public void DrawEllipse(Pen, Rectangle);
[C++] public: void DrawEllipse(Pen*, Rectangle);
[JScript] public function DrawEllipse(Pen, Rectangle);
Draws an ellipse defined by a bounding RectangleF.
[Visual Basic] Overloads Public Sub DrawEllipse(Pen, RectangleF)
[C#] public void DrawEllipse(Pen, RectangleF);
[C++] public: void DrawEllipse(Pen*, RectangleF);
[JScript] public function DrawEllipse(Pen, RectangleF);
Draws an ellipse defined by a bounding rectangle specified by a pair of coordinates, a height, and a width.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Sub DrawEllipse(Pen, Integer, Integer, Integer, Integer)
[C#] public void DrawEllipse(Pen, int, int, int, int);
[C++] public: void DrawEllipse(Pen*, int, int, int, int);
[JScript] public function DrawEllipse(Pen, int, int, int, int);
Draws an ellipse defined by a bounding rectangle specified by a pair of coordinates, a height, and a width.
[Visual Basic] Overloads Public Sub DrawEllipse(Pen, Single, Single, Single, Single)
[C#] public void DrawEllipse(Pen, float, float, float, float);
[C++] public: void DrawEllipse(Pen*, float, float, float, float);
[JScript] public function DrawEllipse(Pen, float, float, float, float);
Example
[Visual Basic, C#] The following example is designed for use with Windows Forms, and it requires PaintEventArgs e, which is a parameter of the Paint event handler. The code performs the following actions:
- Creates a black pen.
- Creates the position and size of a rectangle to bound an ellipse.
- Draws the ellipse to the screen.
[Visual Basic, C#] Note This example shows how to use one of the overloaded versions of DrawEllipse. For other examples that might be available, see the individual overload topics.
[Visual Basic] Public Sub DrawEllipseFloat(e As PaintEventArgs) ' Create pen. Dim blackPen As New Pen(Color.Black, 3) ' Create location and size of ellipse. Dim x As Single = 0F Dim y As Single = 0F Dim width As Single = 200F Dim height As Single = 100F ' Draw ellipse to screen. e.Graphics.DrawEllipse(blackPen, x, y, width, height) End Sub [C#] public void DrawEllipseFloat(PaintEventArgs e) { // Create pen. Pen blackPen = new Pen(Color.Black, 3); // Create location and size of ellipse. float x = 0.0F; float y = 0.0F; float width = 200.0F; float height = 100.0F; // Draw ellipse to screen. e.Graphics.DrawEllipse(blackPen, x, y, width, height); }
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
See Also
Graphics Class | Graphics Members | System.Drawing Namespace