Draws an ellipse specified using a bounding rectangle.
Syntax

[C#]

void DrawEllipse(Pen pen, double x, double y, double width, double height);
void DrawEllipse(Pen pen, RectangleF rect);

[Visual Basic]

Sub DrawEllipse(pen As Pen, x As Double, y As Double, width As Double, height As Double)
Sub DrawEllipse(pen As Pen, rect As RectangleF)
Params
Name Description
pen The pen to use for drawing the ellipse.
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.
rect The bounding rectangle for the ellipse.
Notes

None.

Example

Here we draw two shapes, one blue and one red. The blue shape uses the Bitmap default colors.

[C#]

using (Bitmap bm = new Bitmap(400, 400)) {
  using (Graphics gr = Graphics.FromImage(bm)) {
    gr.FillEllipse(Brushes.Blue, new RectangleF(0, 0, 200, 200));
    gr.DrawEllipse(new Pen(Color.DarkBlue), new RectangleF(0, 0, 200, 200));
    gr.FillEllipse(Brushes.Red, new RectangleF(50, 50, 50, 50));
    gr.DrawEllipse(new Pen(Color.DarkRed), new RectangleF(200, 200, 200, 200));
  }
  bm.Save(Server.MapPath("IG8_Graphics_DrawEllipse.png"));
}



IG8_Graphics_DrawEllipse.png