Call the SetRect function to set the rectangular area.

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.