Add a dialog box to the main view
0. Assume that the project name is Zheng.
1. Create a dialog box with the attribute style: Child, border: None. Add a new class cmainview so that it inherits from public cformview.
2. Change the constructor and destructor of cmainview from protected to public.
3. Rewrite the create function of the cmainview class.
4. Comment out // czhengdoc * getdocument () const in the czhengview class. Delete all getdocument statements in zhengview. H, zhengview. cpp.
5. Delete zhengview. h and print preview in zhengview. cpp. Code .
6. delete all the code about the toolbar and status bar in mainfrm. h and mainfrm. cpp.
7. In mainfrm. h # include "mainview. h". Add a cmainview Class Object Pointer public: cmainview * m_mainview;
8. Add code to the create function in mainfrm. cpp.
Crect rect;
Getclientrect (rect );
M_mainview = new cmainview;
M_mainview-> Create ("cmainview", null, ws_child | ws_visible | ws_border, rect, this, idd_mainview, null );
M_mainview-> oninitialupdate ();
M_mainview-> showwindow (sw_show );
Recalclayout ();
9. Add the onpaint function in mainfrm. cpp so that the new dialog box can be adjusted according to the window.
Crect rect;
Getclientrect (rect );
M_mainview-> movewindow (& rect, 1); 10. Now, a dialog box becomes Program And people will have the scroll bar effect at the same time.
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.