Share via


Graphics.DrawEllipse(const Pen*, INT, INT, INT, INT) method

Applies to: desktop apps only

The Graphics::DrawEllipse method draws an ellipse.

Syntax

Status DrawEllipse(
  [in]  const Pen *pen,
  [in]  INT x,
  [in]  INT y,
  [in]  INT width,
  [in]  INT height
);

Parameters

  • pen [in]
    Type: const Pen*

    Pointer to a pen that is used to draw the ellipse.

  • x [in]
    Type: INT

    Integer that specifies the x-coordinate of the upper-left corner of the rectangle that bounds the ellipse.

  • y [in]
    Type: INT

    Integer that specifies the y-coordinate of the upper-left corner of the rectangle that bounds the ellipse.

  • width [in]
    Type: INT

    Integer that specifies the width of the rectangle that bounds the ellipse.

  • height [in]
    Type: INT

    Integer that specifies the height of the rectangle that bounds the ellipse.

Return value

Type:

Type: Status****

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

Examples

The following example draws an ellipse.

VOID Example_DrawEllipse3(HDC hdc)
{
   Graphics graphics(hdc);

   // Create a Pen object.
   Pen bluePen(Color(255, 0, 0, 255));

   // Initialize the variables that define the ellipse.
   int x = 0;
   int y =0;
   int width = 200;
   int height = 100;

   // Draw the ellipse.
   graphics.DrawEllipse(&bluePen, x, y, width, height);
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusgraphics.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Graphics

FillEllipse Methods

Pen

Ellipses and Arcs

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012