Help Center

GdipAddPathPiefunction

Adds a pie to this path.

Graphicsfunctiondocumented

Syntax

FUNCTION GdipAddPathPie (BYVAL path AS GpPath PTR, BYVAL x AS REAL, BYVAL y AS REAL, BYVAL width AS REAL, BYVAL height AS REAL, BYVAL startAngle AS REAL, BYVAL sweepAngle AS REAL) AS GpStatus
Also documented as GdipAddPathPieI — one description covers them all.

Parameters

NameDescription
path[in] Pointer to the GraphicsPath object.
x[in] The x-coordinate of the upper-left corner of the rectangle that bounds the ellipse that bounds the pie.
y[in] The y-coordinate of the upper-left corner of the rectangle that bounds the ellipse that bounds the pie.
width[in] The width of the rectangle that bounds the ellipse that bounds the pie.
height[in] The height of the rectangle that bounds the ellipse that bounds the pie.
startAngle[in] Simple precision value that specifies the clockwise angle, in degrees, between the horizontal axis of the ellipse and the starting point of the arc that defines the pie.
sweepAngle[in] Simple precision value that specifies the clockwise angle, in degrees, between the starting and ending points of the arc that defines the pie.

Description

Adds a pie to this path. An arc is a portion of an ellipse, and a pie is a portion of the area enclosed by an ellipse. A pie is bounded by an arc and two lines (edges) that go from the center of the ellipse to the endpoints of the arc.

Example

' ======================================================================================== ' This example draws a pie slice using GdipAddPathPie. ' ======================================================================================== SUB Example_DrawPie (BYVAL hdc AS HDC)

DIM hStatus AS LONG

' // Create a graphics object from the device context DIM graphics AS GpGraphics PTR hStatus = GdipCreateFromHDC(hdc, @graphics)

' // Get the DPI scaling ratios DIM dpiX AS SINGLE hStatus = GdipGetDpiX(graphics, @dpiX) DIM rxRatio AS SINGLE = dpiX / 96 DIM dpiY AS SINGLE hStatus = GdipGetDpiY(graphics, @dpiY) Dim ryRatio AS SINGLE = dpiY / 96 ' // Set the scale transform hStatus = GdipScaleWorldTransform(graphics, rxRatio, ryRatio, MatrixOrderPrepend)

' // Create GraphicsPath DIM path AS GpPath PTR hStatus = GdipCreatePath(FillModeAlternate, @path)

' // Add pie slice to path DIM x AS SINGLE = 100 DIM y AS SINGLE = 50 DIM nWidth AS SINGLE = 200 DIM nHeight AS SINGLE = 150 DIM startAngle AS SINGLE = 30 DIM sweepAngle AS SINGLE = 120 hStatus = GdipAddPathPie(path, x, y, nWidth, nHeight, startAngle, sweepAngle)

' // Create pen DIM pen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_CRIMSON, 2, UnitWorld, @pen)

' // Draw path hStatus = GdipDrawPath(graphics, pen, path)

' // Cleanup IF pen THEN GdipDeleteBrush(pen) IF path THEN GdipDeletePath(path) IF graphics THEN GdipDeleteGraphics(graphics)

END SUB ' ========================================================================================

Reference

  • Defined in AfxNova/AfxGdiPlus.bi:2020
  • Documented in Graphics/GdiPlus Flat Api/GdiPlusGraphicsPath.md
  • Topic: GraphicsPath Functions