SetPolyFillMode Function

Declare Function SetPolyFillMode Lib "gdi32.dll" (ByVal hdc As Long, ByVal nPolyFillMode As Long) As Long

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

SetPolyFillMode sets the method used by a device to fill polygonal areas and shapes. The two modes differ only over complex overlapping polygons, where the edges of the polygon criss-cross each other inside the interior (see the example for an example of a complex overlapping polygon). The function returns 0 if an error occured, or exactly one of the polygon fill mode flags specifying the filling mode the device had previously been set to.

hdc
A device context to the device to set the polygon filling mode of.
nPolyFillMode
Exactly one of the following flags specifying the polygon filling mode to use:
ALTERNATE = 1
The device alternates between filling and not filling contiguous sections whose boundaries are determined by the edge(s) of the polygon crossing through the polygon's interior.
WINDING = 2
Any section inside the polygon is filled, regardless of any intra-polygonal boundaries and edges.

Example:

' Use the alternating fill mode to fill that five-pointed star that everyone
' knows so well.  Alternating filling tells window Form1 not to fill in the pentagonal interior
' of the star.  It's hard to describe, so just run the example!
Dim points(0 to 4) As POINT_TYPE  ' points of the star
Dim retval As Long  ' return value

' Load the coordinates of a somewhat distorted five-pointed "pentagram" star
' design into the array.
points(0).x = 200: points(0).y = 400  ' 1st point: (200,400)
points(1).x = 300: points(1).y = 200  ' 2nd point: (300,200)
points(2).x = 400: points(2).y = 400  ' 3rd point: (400,400)
points(3).x = 150: points(3).y = 300  ' 4th point: (150,300)
points(4).x = 450: points(4).y = 300  ' 5th point: (450,300)

' Draw the polygon using alternating fill mode
retval = SetPolyFillMode(Form1.hDC, ALTERNATE)  ' set the fill mode
retval = Polygon(Form1.hDC, points(0), 5)  ' draw the polygon

See Also: GetPolyFillMode
Category: Regions

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/s/setpolyfillmode.html