how to add view to existing template doc
You have missed something. The call
((CMultiViewsApp *)AfxGetApp())->m_pDocTemplate2->CreateNewFrame( this, NULL );opens a new view inside it´s frame. Which class to use is decided by the member variables m_pViewClass and m_pFrameClass in the CDocTemplate class. These variables are set when the document template is created this way:m_pDocTemplate2 = new CMultiDocTemplate( IDR_VIEW2, RUNTIME_CLASS(CMyDoc), RUNTIME_CLASS(CView2Frame), RUNTIME_CLASS(CView2));You can create any number of document templates and have any number of view classes connected to the same document.
2020-02-13
最新推荐文章于 2020-05-31 01:00:27 发布