发信人: mendy.bbs@bbs.nju.edu.cn (孟迪), 信区: cnprogram
标  题: VC FAQ(8)
发信站: nju_bbs (Sun Apr 19 13:50:39 1998)
转信站: Lilac!ustcnews!nju_bbs

2m发信人:m TMN (派生类)
2m信  区:m RAD
2m标  题:m VC FAQ(8)
2m发信站:m '3m紫金飞鸿m' (Wed Apr  8 08:15:50 1998) , 5m站内信件m

[返回首页] [分类讨论区] [全部讨论区]

------------------------------------------ 
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 


  

                         [返回首页] [分类讨论区] [全部讨论区]

--
m;31m※ 来源:·紫金飞鸿 bbs.njupt.edu.cn·[FROM: pc05.info.njupt]m

--
※ 来源:.南大小百合信息交换站 bbs.nju.edu.cn.[FROM: a507yjh.nju.edu]
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.072毫秒