MFC Drawing Control-mapping mode

Source: Internet
Author: User

First, the basic concept of mapping mode

The mapping mode is a Device Description table property that determines how the logical coordinate value is converted to the device coordinate value. The logical coordinate value that is passed to the CDC output function. The device coordinate value refers to the corresponding pixel point position in the window.

Mm_text is the default mapping mode and can be called Cdc::setmapmode () if other mapping modes are used.

1 DC. Setmapmode (mm_lometric);   2 // Do some drawing  

Windows supports 8 different mapping modes, with the following attributes:

Note: If you draw a 100-unit-long line in mm_loenglish mapping mode, it may not be exactly 1 inches long. The reason is that Windows does not know the physical resolution (DPI) of the Monitor, which is the number of points that the monitor can display in the horizontal or vertical direction of each inch.

Second, moving the origin point

1. Cdc::setwindoworg (), moves the window origin and processes the logical coordinate values. Cdc::setviewportorg (), moves the viewport origin, and processes the device coordinate values.

2. setwindoworg (x, y), moving the window origin to (x, y) is equivalent to telling Windows to map a logical point (x, y) to a device point (0, 0).

3. setviewportorg (x, y), moving the viewport origin to (x, y) is equivalent to telling Windows to map a logical point (0, 0) to a device point (x, y).

1 cclientdc DC (this);   2 DC. Setmapmode (mm_text);   3 DC. SetWindowOrg (CPoint ());   4 DC. Rectangle (CRect ());  

MFC Drawing Control-mapping mode

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.