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

The Graphics::DrawPie method draws a pie.

Syntax

Status DrawPie(
  [in]      const Pen    *pen,
  [in, ref] const Rect & rect,
  [in]      REAL         startAngle,
  [in]      REAL         sweepAngle
);

Parameters

[in] pen

Type: const Pen*

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

[in, ref] rect

Type: const Rect

Reference to a 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_DrawPie(HDC hdc)
{
   Graphics graphics(hdc);

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

   // Define the pie.
   Rect ellipseRect(0, 0, 200, 100);
   REAL startAngle = 0.0f;
   REAL sweepAngle = 45.0f;

   // Draw the pie.
   graphics.DrawPie(&blackPen, ellipseRect, 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

DrawLines Methods

FillPie Methods

Graphics

Open and Closed Curves

Rect