RECT Structure
The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle. This structure is used in conjunction with various GDI functions and windowing functions.
Syntax
typedef struct _RECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT;
Members
| Member | Description |
|---|---|
left |
The x-coordinate of the upper-left corner of the rectangle. |
top |
The y-coordinate of the upper-left corner of the rectangle. |
right |
The x-coordinate of the lower-right corner of the rectangle. |
bottom |
The y-coordinate of the lower-right corner of the rectangle. |
Remarks
The coordinates of a rectangle are relative to the upper-left corner of the screen.
The left member is the x-coordinate of the left side and the right member is the x-coordinate of the right side.
The top member is the y-coordinate of the top side and the bottom member is the y-coordinate of the bottom side.
In a RECT structure, the following conditions are generally true:
leftis less than or equal toright.topis less than or equal tobottom.
However, some functions may accept rectangles where these conditions are not met, interpreting them as empty rectangles.
For example, a rectangle where left is greater than right or top is greater than bottom is considered an invalid or empty rectangle.
top coordinate is usually smaller than the bottom coordinate for valid rectangles.