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.
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.