SetRect Function

Declare Function SetRect Lib "user32.dll" (lpRect As RECT, 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

SetRect sets the position and size of a rectangle. The two coordinates specified are the upper-left and lower-right corners of the rectangle. The function returns 0 if an error occured, or 1 if successful.

lpRect
The rectangle to set the position and size of.
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.

Example:

' Set rectangle r to represent the rectangle (20,30)-(100,50).  Note
' that using this function is more efficient and takes less room than setting the rectangle's
' four member values individually.
Dim r As RECT  ' the rectangle to set
Dim retval As Long  ' return value

retval = SetRect(r, 20, 30, 100, 50)  ' r now represents (20,30)-(100,50)
See Also: SetRectEmpty
Category: Rectangles

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/setrect.html