Declare Function InflateRect Lib "user32.dll" (lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long
Platforms: Win 32s, Win 95/98, Win NT
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 1 if successful.
Example:
' Expand the width of window Form1 by 100 and shrink its
' height by 50 using its rectangle.
Dim winrect As RECT ' receives the rectangle of the window
Dim retval As Long ' return value
retval = GetWindowRect(Form1.hWnd, winrect) ' get Form1's rectangle
retval = InflateRect(winrect, 50, -25) ' these values added to each side to inflate it
' Now change the window on screen to match its new rectangle
retval = SetWindowPos(Form1.hWnd, 0, winrect.Left, winrect.Top, winrect.Right, winrect.Bottom, 0)
See Also: OffsetRect
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/i/inflaterect.html