Graphics.DrawPie(const Pen*, const RectF, REAL, REAL) method

Applies to: desktop apps only

The Graphics::DrawPie method draws a pie.

Syntax

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

Parameters

  • pen [in]
    Type: const Pen*

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

  • rect [in, ref]
    Type: const RectF

    Rectangle that bounds the ellipse in which to draw the pie.

  • startAngle [in]
    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.

  • sweepAngle [in]
    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:

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_DrawPie2(HDC hdc)
{
   Graphics graphics(hdc);

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

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

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

FillPie Methods

RectF

Open and Closed Curves

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012