Declare Function OffsetRect Lib "user32.dll" (lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long
OffsetRect changes the position of a rectangle without changing its size. If the value to move by is negative, the rectangle is moved left or up (depending on the direction); positive values move it right or down. The function returns 0 if an error occured, or a non-zero value if successful.
Example:
' Move a rectangle 100 right and 25 up
Dim r As RECT
x = SetRect(r, 50, 50, 150, 150) ' API function sets r = (50,50)-(150,150)
x = OffsetRect(r, 100, -25) ' now r = (150,25)-(250,125)
Related Call: InflateRect
Category: Rectangles
Back to the index.