Two-dimensional pointer and one-dimensional pointer

Source: Internet
Author: User

Class M...

M m [2] [4];

M (* pm) [4] (M );

PM is an array pointer pointing to four data items, which is the same as the number of column elements in a two-dimensional array.

Reference format

For (I = 0; I <2; I ++)

{

Cout <end;

For (Int J = 0; j <4; j ++)

(* (PM + I) + J). Print ();

}

Cout <Endl;

Windows coordinate system and ing mode

One Windows Coordinate System

1. device coordinates (also known as physical coordinates) Physical Coordinate

Device coordinates are a coordinate system that describes the forms displayed or printed on the screen and printer. The default coordinate origin is in the upper left corner of the customer zone. The X axis is positive to the right, and the Y axis is downward. The measurement unit is pixel. The source and axis direction can be changed, but the measurement unit cannot be changed.

Windows includes the following three device coordinates to meet different needs:

(1) Customer Region coordinates, including the customer region of the application. The upper left corner of the customer region is (0, 0 ).

(2) screen coordinates, including the entire screen. The upper left corner of the screen is (0, 0 ). Screen coordinates are used in wm_move messages (for non-subwindows) and the following Windows functions: createwindow and movewindow (both for non-subwindows), getmessage, getcursorpos, getwindowrect, windowfrompoint, and setbrushorg. Using the clienttoscreen and screentoclient functions, you can convert the client region to the screen region coordinate, or vice versa.

(3) window coordinates, including the entire window of a program, including the title bar, menu, scroll bar, and window box. The upper left corner of the window is (0, 0 ). You can use the getwindowdc window device environment to convert the logical unit into window coordinates.

2. Logical coordinates

Logical coordinates are the coordinate system used to control the display and print in the program. The coordinate system is closely related to the defined ing mode. The default ing mode is mm_text. We can change the default behavior of the coordinate system by setting different ing modes.

Two-view and window

It is easy to confuse the concepts of the view and window. In fact, the window and the view are associated with the ing mode: The ing mode is used from the "window" (logical coordinates) ing to the "viewport" (device coordinates. The "View" is based on device coordinates. Generally, the view is the same as the customer area. The "window" is based on logical coordinates, and the logical coordinates can be pixels, millimeters, and inches.

Three- ing mode

It refers to the conversion from logical coordinates to device coordinates. The ing mode shows a ing function from logical coordinates to device functions. There are eight ing modes: mm_text, mm_hienglish, mm_loenglish, mm_himetric, mm_lometric, mm_twips, mm_anisotropic, and mm_isotropic.

Four application sites
1. All member functions of the CDC class Use logical coordinates as parameters.

2. All member functions of cwnd use device coordinates as parameters.

3 device coordinates should be considered for all selected test operations. The definition and use of a region (crect) should adopt device coordinates.

4. Save some values that require long-term use using logical coordinates. Because the device coordinates of a certain point may be invalid when the window is rolled.

5 In VC, the mouse position is represented by device coordinates. if you draw a picture with the mouse, you must first convert

Setviewportorgex (X, Y) is used to move the origin point to (x, y)
Setdomainworgex (-X,-Y) is used to shift the X axis to the right.
The animation-x unit moves the Y axis-y units.

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.