CreateRectRgnIndirect Function

Declare Function CreateRectRgnIndirect Lib "gdi32.dll" (lpRect As RECT) As Long

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

CreateRectRgnIndirect creates a rectangularly-shaped region and provides a handle to it. The rectangle defining the region is specified by the rectangle passed to the function. Note that the bottom and right edges of the rectangle are not considered to be part of the region. The function returns a handle to the newly created region if successful, or 0 if an error occured.

lpRect
The rectangle which defines the rectangular region to create.

Example:

' Invert the pixels within a rectangular region on window Form1. The region
' has corners (20,30)-(150,110).
Dim therect As RECT ' rectangle used to create region
Dim hrgn As Long  ' handle to the rectangular region
Dim retval As Long  ' return value

' Set the rectangle to use to create the region.
retval = SetRect(therect, 20, 30, 150, 110)  ' therect = (20,30)-(150,110)
' Create the rectangular region based on this rectangle.
hrgn = CreateRectRgnIndirect(therect)
' Invert the pixels within this region on Form1.
retval = InvertRgn(Form1.hDC, hrgn)
' Delete the region to free up resources.
retval = DeleteObject(hrgn)

See Also: CreateRectRgn, CreateRoundRectRgn
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/createrectrgnindirect.html