InflateRect Function

Declare Function InflateRect Lib "user32.dll" (lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long

InflateRect increases or decreases the size of a rectangle. The values to inflate the rectangle by are added to both sides of it, so in reality the width and/or height of the rectangle increases by double what you pass to the function. For example, if you pass 20 as x, the left and right sides will both be extended by 20, so the total width will be 40 more. Positive values increase the size, while negative values decrease it. The function returns 0 if an error occured, or a non-zero value if successful.

lpRect
The rectangle to change the size of.
x
The value to expand the left and right sides by. Positive values increase the width; negative values decrease it.
y
The value to expand the top and bottom by. Positive values increase the height; negative values decrease it.

Example:

' Expand a rectangle by 30 left and right and -10 on top and bottom
Dim r As RECT
x = SetRect(r, 50, 50, 100, 100)  ' API sets r = (50,50)-(100,100)
x = InflateRect(r, 30, -10)  ' now r = (20,60)-(130,90)

Related Call: OffsetRect
Category: Rectangles
Back to the index.


Back to Paul Kuliniewicz's Home Page
E-mail: Borg953@aol.com
This page is at http://members.aol.com/Borg953/api/functions/inflaterect.html