Graphics::DrawPie(constPen*,INT,INT,INT,INT,REAL,REAL) method (gdiplusgraphics.h)

The Graphics::DrawPie method draws a pie.

Syntax

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

Parameters

[in] pen

Type: const Pen*

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

[in] x

Type: INT

Integer that specifies the x-coordinate of the upper-left corner of the rectangle that bounds the ellipse in which to draw the pie.

[in] y

Type: INT

Integer that specifies the y-coordinate of the upper-left corner of the rectangle that bounds the ellipse in which to draw the pie.

[in] width

Type: INT

Integer that specifies the width of the rectangle that bounds the ellipse in which to draw the pie.

[in] height

Type: INT

Integer that specifies the height of the rectangle that bounds the ellipse in which to draw the pie.

[in] startAngle

Type: REAL

Real number that specifies the angle, in degrees, between the x-axis and the starting point of the arc that defines the pie. A positive value specifies clockwise rotation.

[in] sweepAngle

Type: REAL

Real number that specifies the angle, in degrees, between the starting and ending points of the arc that defines the pie. A positive value specifies clockwise rotation.

Return value

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.

Remarks

The following illustration shows the pie that is drawn in the ellipse that is bounded by the rectangle. The illustration also shows the horizontal axis of the ellipse and the direction of the startAngle and the sweepAngle.

Illustration showing an ellipse with an outlined pie; the start angle and sweep angle are labeled

Examples

The following example draws a pie.


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

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

   // Define the pie.
   int x = 0;
   int y = 0;
   int width = 200;
   int height = 100;
   REAL startAngle = 0.0f;
   REAL sweepAngle = 45.0f;

   // Draw the pie.
   graphics.DrawPie(&blackPen, x, y, width, height, startAngle, sweepAngle);
}

Requirements

Requirement Value
Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdiplusgraphics.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

FillPie Methods

Graphics

Open and Closed Curves

Rect