WinInflateRect
This function expands a rectangle.
Syntax
WinInflateRect(hab, prcl, cx, cy)
Parameters
- hab (HAB) - Input
- Anchor-block handle.
- prcl (PRECTL) - In/Out
- Rectangle to be expanded.
- Note
- The value of each field in this structure must be in the range -32 768 through 32 767. The data type WRECT can also be used, if supported by the language.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE
- Successful completion
- FALSE
- Error occurred.
Remarks
This function adjusts the size of the rectangle by applying the cx parameter horizontally at both vertical edges and the cy parameter vertically at both horizontal edges. The cx parameter is subtracted from the left and added to the right of the rectangle, and the cy parameter is subtracted from the bottom and added to the top of the rectangle. If the values of the cx and cy parameters are both positive, the rectangle is enlarged and surrounds the original rectangle. Conversely, if both these values are negative, the rectangle is reduced in size and is inset with respect to the original rectangle.
Errors
Possible returns from WinGetLastError: (No specific errors were listed in the provided text.)
Example Code
#define INCL_WINRECTANGLES /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HAB hab; /* Anchor-block handle. */ PRECTL prcl; /* Rectangle to be expanded. */ LONG cx; /* Horizontal expansion. */ LONG cy; /* Vertical expansion. */ BOOL rc; /* Success indicator. */ rc = WinInflateRect(hab, prcl, cx, cy);
This example doubles the size of a rectangle if the mouse is double clicked (WM_BUTTON1DBLCLK) within the rectangle (WinPtInRect).
#define INCL_WINRECTANGLES /* Window Rectangle Functions */ #include <os2.h> BOOL fSuccess; /* success indicator */ HAB hab; /* anchor-block handle */ RECTL prclRect1 = {0,0,100,100}; /* rectangle */ LONG lcx = 100; /* Horizontal expansion */ LONG lcy = 100; /* Vertical expansion */ POINTL ptl; /* current mouse position */ MPARAM mpParam1; /* Parameter 1 (x,y) point value */ case WM_BUTTON1DBLCLK: ptl.x = (LONG) SHORT1FROMMP(mpParam1); ptl.y = (LONG) SHORT2FROMMP(mpParam1); if (WinPtInRect(hab, &prclRect1, &ptl)) fSuccess = WinInflateRect(hab, &prclRect1, lcx, lcy);