MFC rubber band technology ~

Source: Internet
Author: User

Rubber Band technology has three processes:

1. Click the left mouse button to record the start point.

2. Move the mouse: draw a straight line from the starting point to the existing point, and delete the previous line.

3. left-click release: draw a straight line from the start point to the existing point.

I perform the following operations:

DC. setrop2 (r2_not );

Process 1:

Void cdraw_line_rubber_band_skillview: onmbuttondown (uint nflags, cpoint point)
{
// Todo: Add message processing hereProgramCodeAnd/or call the default value
Flag = true;
M_ptold = m_ptorigin = point;
Cview: onmbuttondown (nflags, point );
}

Process 2:

Void cdraw_line_rubber_band_skillview: onmousemove (uint nflags, cpoint point)
{
// Todo: add the message processing program code and/or call the default value here
If (FLAG ){
Cclientdc DC (this );
DC. setrop2 (r2_not );
DC. moveTo (m_ptorigin );
DC. lineto (m_ptold );
DC. moveTo (m_ptorigin );
DC. lineto (point );
M_ptold = point;
Cview: onmousemove (nflags, point );
}
}

Process 3:

Void cdraw_line_rubber_band_skillview: onmbuttonup (uint nflags, cpoint point)
{
// Todo: add the message processing program code and/or call the default value here
Flag = false;
Cclientdc DC (this );
DC. moveTo (m_ptorigin );
DC. lineto (point );
Cview: onmbuttonup (nflags, point );
}

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.