CreateRoundRectRgn Function

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

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

CreateRoundRectRgn creates a rounded rectangular region and provides a handle to it. The region is shaped like a rectangle with rounded corners. The region is specified by the coordinate of a non-rounded rectangle followed by the width and height of the rounded corners. 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 rectangle.
Y1
The y-coordinate of the upper-left corner of the rectangle.
X2
The x-coordinate of the lower-right corner of the rectangle.
Y2
The y-coordinate of the lower-right corner of the rectangle.
X3
The width of the portion of each corner to round.
Y3
The height of the portion of each corner to round.

Example:

' Invert the pixels within a rounded rectangular region on window Form1.  The
' equivalent non-rounded rectangle has corners (20,30)-(150,110).  The rounded corners have
' a width of 15 and a height of 10.
Dim hrgn As Long  ' handle to the created rounded rectangular region
Dim retval As Long  ' return value

' Create the rounded rectangular region and get a handle to it.
hrgn = CreateRoundRectRgn(20, 30, 150, 110, 15, 10)
' Invert the pixels in Form1 within this region.
retval = InvertRgn(Form1.hDC, hrgn)
' Delete the region to free up resources.
retval = DeleteObject(hrgn)

See Also: CreateRectRgn, CreateRectRgnIndirect
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/c/createroundrectrgn.html