Programming 版 (精华区)

作  家: compus (蓝天) on board 'programming'
题  目: Use new views with a doc template
来  源: 哈尔滨紫丁香站
日  期: Sun Aug 10 12:52:26 1997
出  处: compus.bbs@bbs.net.tsinghua.edu.cn

------------------------------------------
 How use new views with a doc template?
------------------------------------------

In an application created with AppWizard, you have two options: change the 
derivation of the current view, or create a new view and use the new view in 
your MDI application along with the original view.

To create a new view, use ClassWizard to create a new class derived from 
CView. After the class has been created, the steps to use the new view or to 
modify the view provided by App Wizard are the same.

1.  Modify the header file for the view class to change all references to 
CView to the name of the desired view class. In this example, the class is 
derived from CScrollView.
Usually, this step involves changing the class the view class is derived from 
as follows:


 class CMyView : public CScrollView


2.  Modify the implementation file for the view class to change all 
references to CView to the name of the desired view class. This involves 
changing the IMPLEMENT_DYNCREATE line as follows:

IMPLEMENT_DYNCREATE(CMyView, CScrollView)


        changing the BEGIN_MESSAGE_MAP as follows:

BEGIN_MESSAGE_MAP(CMyView, CScrollView)

and changing any other references to CView to CScrollView.


3.  No further modifications are required if you are modifying a view created 
by App Wizard. If you create a new view, find the AddDocTemplate() call in 
the CWinApp::InitInstance() function. The third parameter to AddDocTemplate() 
is       RUNTIME_CLASS(CSomeView). To replace the current view with the new 
view class, change CSomeView to CMyView. In an MDI application, you can use 
multiple view types by adding a second AddDocTemplate() call that changes 
RUNTIME_CLASS(CSomeView) to RUNTIME_CLASS(CMyView).

For more information, please see Knowledge Base article Q99562.

MSVC Knowledge Base 6/7/95


 

--
※ 来源:·哈尔滨紫丁香站 bbs1.hit.edu.cn·[FROM: compus.bbs@bbs.net.t] 
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:6.691毫秒