The basic concept of Windows programming point, Size

Source: Internet
Author: User

[Point, Size] of the basic concept of Windows programming

Tocy Time: 2014-09-20

  1. Point- related concepts

    In a two-dimensional coordinate system, it takes two data to mark a point. Typically in an orthogonal coordinate system, a point is uniquely determined by giving the offset (two directions) of a point relative to the origin of the coordinate.

    The point is defined in Windows as follows:

    typedef struct tagpoint {

    LONG x;

    LONG y;

    } point;

    In the Windows screen coordinate system, the coordinate Origin O (0,0) is in the upper-left corner of the screen, the x-axis is in the positive direction from left to right and the y-axis is from top to bottom. The x in the above point definition represents an X-direction offset, often referred to as a transverse offset (horizontal offset), and y for the Y-directional offset, often referred to as a longitudinal offset (Vertical offset).

    You can use the point struct directly or customize two integer variable overrides in real-world programming.

    CPoint is recommended in MFC, using the following link, (v=vs.120). aspx. CPoint provides a constructor, offset offset function, and overloads the operators of + 、-、 + =,-=, = =,! =, to some extent simplifying usage.

  2. Size Related Concepts

    The size is primarily used to represent the width of the rectangular area. The following are defined in Windows:

    typedef struct tagsize {

    LONG CX;

    LONG Cy;

    } SIZE, *PSIZE;

    Where CX represents the width of the rectangular area, and Cy represents the height of the rectangular area. In particular, CX, CY represents only numeric values, and the specific units may be related to the following factors: view extent, window extent, text range, bitmap size, and so on.

    MFC recommended the use of csize, usage can refer to the following link, CSize only provides constructors and operator overloading (+ 、-、 + =,-=, = =,! =).

Note: All rights reserved, do not use for commercial purposes, please specify the original address reproduced. I reserve all rights.

The basic concept of Windows programming point, Size

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: 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.