Pie Function

Declare Function Pie Lib "gdi32.dll" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long, ByVal X4 As Long, ByVal Y4 As Long) As Long

Platforms: Win 32s, Win 95/98, Win NT

Pie draws an elliptical pie wedge on a device. The pie wedge is drawn using the device's currently selected pen and is filled using its currently selected brush. The pie wedge consists of two radials from the ellipse's center to the ellipse's edge, filling the area between them (going counterclockwise around the ellipse). The first two sets of (x,y) coordinate pairs specify the bounding rectangle which determines the ellipse. The last two sets of (x,y) pairs determine the points along the ellipse; the start and endpoints are determined by the intersection of a ray from the ellipse's center through the (x,y) coordinate and the ellipse. The function returns 1 if successful, or 0 if an error occured.

hdc
A device context to the device to draw the chord on.
X1
The x-coordinate of the upper-left corner of the ellipse's bounding rectangle.
Y1
The y-coordinate of the upper-left corner of the ellipse's bounding rectangle.
X2
The x-coordinate of the lower-right corner of the ellipse's bounding rectangle.
Y2
The y-coordinate of the lower-right corner of the ellipse's bounding rectangle.
X3
The x-coordinate of the point determining the starting point of the pie wedge.
Y3
The y-coordinate of the point determining the starting point of the pie wedge.
X4
The x-coordinate of the point determining the ending point of the pie wedge.
Y4
The y-coordinate of the point determining the ending point of the pie wedge.

Example:

' Draw a pie wedge on window Form1.  The ellipse has a bounding rectangle
' of (10,20)-(210,120).  The pie wedge will have endpoints on the ellipse of (210,70)
' and (110,20) -- i.e., the "upper-right" fourth of the ellipse.  Draw the pie wedge
' using Form1's current brush and pen.
Dim retval As Long  ' return value

' Draw the chord as specified above.
retval = Pie(Form1.hDC, 10, 20, 210, 120, 210, 70, 110, 20)

See Also: Chord, Ellipse
Category: Filled Shapes

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/p/pie.html