荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: Peter (小飞侠), 信区: Program
标  题: VC FAQ(8)
发信站: BBS 荔园晨风站 (Tue Jan 26 22:51:38 1999), 转信


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


--
※ 来源:.BBS 荔园晨风站 bbs.szu.edu.cn.[FROM: 192.168.1.3]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店