MFC drawing BASICS--on-machine operation steps

Source: Internet
Author: User

Software Environment: vc++6.0 Objective: To be familiar with the basic MFC framework building and understanding interface one, MFC on-machine operation steps

1. Run vc++6.0 on the Windows desktop.

2, new project engineering documents.

3, in the MFC Application Wizard-Step 1 dialog box, select the Single Document radio button, and the rest remains the default.

4, Pop Up the dialog box for the new project information, and click OK.

5, after completing the above steps, the Project Testone MFC framework has been generated.

6, there are 3 tabs in the left work window of the integrated development environment.

    • ClassView displays the class and member functions that are created
    • ResourceView to display the resources created
    • FileView display program files, mainly including program source files, header files, and resource files

7, the member function OnDraw () can be found in the source file TestView.cpp of the Ctestview class. The contents are as follows:

void Ctestoneview::ondraw (cdc* pDC) {    ctestonedoc* pDoc = getdocument ();    Assert_valid (PDOC);     // Todo:add Draw code for native datahere}

Where the PDC is defined as a pointer to the CDC class. Pdoc A pointer to the document class Ctestonedoc through the GetDocument () function. The Assert_valid (PDOC) function makes the PDOC pointer valid. The member functions of the CDC class can be manipulated using the PDC pointer.

Note: the OnDraw () function is called directly by the system framework and is automatically executed whenever the window is redrawn.

8, click the button on the toolbar, you can directly compile, run the program.

Conclusion

At this point, although a line of code has not been written, the test project has formed a framework for an executable program. The next job is to add your own program code to the framework for the specific design task.

Next up is coding~~~.

MFC drawing BASICS--on-machine operation steps

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.