Graphics.DrawArc(const Pen*, REAL, REAL, REAL, REAL, REAL, REAL) method

Applies to: desktop apps only

The Graphics::DrawArc method draws an arc. The arc is part of an ellipse.

Syntax

Status DrawArc(
  [in]  const Pen *pen,
  [in]  REAL x,
  [in]  REAL y,
  [in]  REAL width,
  [in]  REAL height,
  [in]  REAL startAngle,
  [in]  REAL sweepAngle
);

Parameters

  • pen [in]
    Type: const Pen*

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

  • x [in]
    Type: REAL

    Real number that specifies the x-coordinate of the upper-left corner of the bounding rectangle for the ellipse that contains the arc.

  • y [in]
    Type: REAL

    Real number that specifies the y-coordinate of the upper-left corner of the bounding rectangle for the ellipse that contains the arc.

  • width [in]
    Type: REAL

    Real number that specifies the width of the ellipse that contains the arc.

  • height [in]
    Type: REAL

    Real number that specifies the height of the ellipse that contains the arc.

  • startAngle [in]
    Type: REAL

    Real number that specifies the angle between the x-axis and the starting point of the arc.

  • sweepAngle [in]
    Type: REAL

    Real number that specifies the angle between the starting and ending points of the arc.

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 a 90-degree arc.

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

   // Set up the arc.
   Pen redPen(Color(255, 255, 0, 0), 3);
   REAL x = 0;
   REAL y = 0;
   REAL width = 200.0f;
   REAL height = 100.0f;
   REAL startAngle = 0.0f;
   REAL sweepAngle = 90.0f;

   // Draw the arc.
   graphics.DrawArc(&redPen, x, y, width, height, startAngle, sweepAngle);
}

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

DrawArc Methods

DrawEllipse Methods

Pen

Rect

Creating Figures from Lines, Curves, and Shapes

Ellipses and Arcs

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012