Introduction to common classes, macros and functions in MFC

Source: Internet
Author: User

 

Common classes

CRect:A class used to represent a rectangle. It has four member variables:Top left bottom right. The tables are the coordinates in the upper left corner and lower right corner. You can construct it using the following methods:

  • CRect (intL, IntT, IntR, IntB); Specify four coordinates
  • CRect (const RECT &SrcRect); Constructed by RECT Structure
  • CRect (LPCRECTLpSrcRect); Constructed by RECT Structure
  • CRect (POINTPoint, SIZESize); Coordinates and dimensions are constructed in the upper left corner.
  • CRect (POINTTopLeft, POINTBottomRight); Two-point coordinate structure

The following describes several member functions:

  • Int Width () const; returns the Width.
  • Int Height () const; get the Height
  • CSize Size () const; obtain the Size
  • CPoint & TopLeft ();
  • CPoint & BottomRight ();
  • CPoint CenterPoint () const; proper Central Coordinates

In addition, the rectangle can be (CPoint) is used to add the rectangle and the rectangle after the "and" operation is obtained by adding it to the other rectangle.

CPoint:Used to represent the coordinates of a point. There are two member variables:X y. It can be added to another vertex.

CString:A variable-length string. UseCString does not specify the memory size. CString will be allocated as needed. The following describes several member functions:

  • Get the string length by GetLength
  • Get the character at the specified position by GetAt.
  • Operator + is equivalent to strcat
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.