One-day training of Windows APIs (31) movetoex and lineto Functions

Source: Internet
Author: User

Currently, the graphic interface is popular in the world, rather than text. Therefore, in software development, you must draw a picture, for example, simply draw a line and draw some special images. For example, if you want to draw a moving clock, you need to constantly draw seconds and minutes. Movetoex is used to move the current position of the paint brush, and lineto is used to draw a straight line. In fact, the linear display in computer graphics uses the principle of grating graphics.

The movetoex and lineto functions are declared as follows:
Wingdiapi bool winapi movetoex (_ in HDC, _ in int X, _ in int y, _ out_opt lppoint lppt );
HDCIs the handle of the current device.
XIt is the position of the X axis and the horizontal direction. Generally, the origin is the position in the upper left corner of the screen.
YIs the position of the Y axis, vertical direction.
LpptIs the Coordinate Position before moving.

Wingdiapi bool winapi lineto (_ in HDC, _ in int X, _ in int y );
HDCIs the handle of the current device.
XIt is the position of the X axis and the horizontal direction. Generally, the origin is the position in the upper left corner of the screen.
YIs the position of the Y axis, vertical direction.

An example of calling this function is as follows:
#001 //
#002 // The output is displayed on the interface.
#003 //
#004 // Cai junsheng 2007/09/08 QQ: 9073204 Shenzhen
#005 //
#006 void ccaiwinmsg: ondraw (HDC)
#007 {
#008 // move to the specified location.
#009 point ptlefttop;
#010 ptlefttop. x = 10;
#011 ptlefttop. Y = 10;
#012 movetoex (HDC, ptlefttop. X, ptlefttop. Y, null );
#013
#014 // draw a straight line from (10, 10) to (100,100.
#015 ptlefttop. x = 100;
#016 ptlefttop. Y = 100;
#017 lineto (HDC, ptlefttop. X, ptlefttop. y );
#018
#019}

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.