C ++ _ series of self-study courses _ Lesson _ Test

Source: Internet
Author: User

After reading a video tutorial from Sun Xin one day, I found that in fact, using MFC for programming in VC ++ can also intercept messages and establish messages

Map to process messages.

Hey, I testedCode.

We found that XP and 2000 have different ranges for handling customer zones.

Void cdrawview: onlbuttonup (uint nflags, cpoint point) {// todo: add your message handler code here and/or call default // * use a global function to implement the draw line function */* HDC; HDC =: getdc (this-> m_hwnd),: movetoex (HDC, m_point.x, m_point.y, null);: lineto (HDC, point. x, point. y);: releasedc (m_hwnd, HDC ); * /// // * use the CDC class to implement the draw line function * // * CDC * PDC = getdc (); PDC-> moveTo (m_point); PDC-> lineto (point); releasedc (PDC ); * //// // * use the cclientdc class to implement the wire draw function * // * cclientdc DC (this); DC. moveTo (m_point.x, m_point.y); DC. lineto (point); * // * cclientdc (getparent (); DC. moveTo (m_point); DC. lineto (point); * // * use the cwindowdc class to draw lines * // * cwindowdc DC (this ); DC. moveTo (m_point); DC. lineto (point); * // * cwindowdc (getmediatopwindow (); DC. moveTo (m_point); DC. lineto (point); DC. textout (100,100, "volcanol", strlen ("volcanol ")); * ////////// // * draw a colored line * // use the cpen class for color drawing/* cpen pen (ps_solid, 5, RGB (123,); cclientdc DC (this); cpen * oldpen = dc. selectObject (& pen); DC. moveTo (m_point); DC. lineto (point); DC. selectObject (& oldpen); * // * use the paint brush to draw the image * // * cbrush brush (RGB (, 23, 255); // create a painter cclientdc (this); // obtain the device content DC in the customer's region. fillrect (crect (m_point, point), & brush ); // fill the area * // * use bitmap to draw a map * // * cbitmap bitmap; bitmap. loadbitmap (idb_bitmap1); cbrush brush (& Bitmap); cclientdc DC (this); // obtain the device content DC in the customer region. fillrect (crect (m_point, point), & brush); // fill area */

If you are familiar with MFC and winapi, use VC to develop an application.ProgramIt's quite quick,

Use MFC to create an interface, and use winapi to implement applications.

In fact, you can implement a program architecture through your own encapsulation.

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.