CreateEllipticRgn Function

Declare Function CreateEllipticRgn Lib "gdi32.dll" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long

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

CreateEllipticRgn creates an elliptically-shaped region. The ellipse which forms the region is specified by the bounding rectangle defined by the coordinates passed to the function. The bounding rectangle is the smallest possible rectangle which can fit around the ellipse. The function returns a handle to the newly created region if successful, or 0 if an error occured.

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.

Example:

' Invert the pixels within an elliptical region on window Form1.  The
' elliptical region has a bounding rectangle of (20,30)-(150,110).
Dim hrgn As Long  ' handle to the region to invert
Dim retval As Long  ' return value

' Create the elliptical region to invert and get a handle to it.
hrgn = CreateEllipticRgn(20,30,150,110)  ' bounding rectangle (20,30)-(150,110)
' Invert that region in window Form1.
retval = InvertRgn(Form1.hDC, hrgn)
' Delete the region to free up resources.
retval = DeleteObject(hrgn)

Related Call: CreateEllipticRgnIndirect
Category: Regions
Back to the index.


Go to Paul Kuliniewicz's Home Page.
E-mail: rogue953@hotmail.com
This page is at http://skyscraper.fortunecity.com/transmission/45/api/c/createellipticrgn.html