Rectangle and area
Windows contains several plotting functions that use the RECT (rectangle) structure and the RGN area. An area is a part of the screen. It is a combination of rectangle, polygon, and elliptic.
The following three plot functions need a pointer to the rectangle structure:
In these functions, the rect parameter is a RECT structure, which contains four fields: left, top, right, and bottom. The coordinates in this structure are treated as logical coordinates.
FillRect uses a designated image brush to fill in the rectangle. This function does not need to first select the image brush into the device content.
FrameRect draws a rectangular box with a paint brush, but does not fill in a rectangle. It looks a little strange to use a paint brush to draw a Rectangle, because the edges of the introduced functions (such as Rectangle) are all drawn with the current paint brush. FrameRect allows users to draw a rectangle box that is not necessarily a solid color. The boundary is a logical unit element width. If the logical unit is greater than the device unit, the border box is 2 pixels wide or wider.
InvertRect switches all pixels in the rectangle, 1 to 0, 0 to 1, this function turns the white area into black, the black area into white, the green area into the magenta.
You can call the SetRect function to set the rectangular area:
SetRect (& rect, xLeft, yTop, xRight, yBottom );
The following eight functions facilitate some basic operations.
Move the X axis and Y axis of the rectangular eye to several units:
OffsetRect (& rect, x, y );
Increase or decrease the rectangle size:
InflateRect (& rect, x, y );
Each field in the rectangle is set to 0:
SetRectEmpty (& rect );
Copy the rectangle to another rectangle:
CopyRect (& DestRect, & SrcRect );
Obtain the intersection of two rectangles:
IntersectRect (& DestRect, & SrcRect1, & SrcRect2 );
Get a collection of two rectangles:
UnionRect (& DestRect, & SrcRect1, & SrcRect2 );
Determine whether the rectangle is empty:
BEmpty = IsRectEmpty (& rect );
Determine whether the vertex is in the rectangle:
BInRect = PtInRect (& rect, point );
This article from the "iphone10" blog, please be sure to keep this source http://iphone10.blog.51cto.com/6931928/1264866