00000019.txt
来自「水木清华BBS站的讨论区精华集锦」· 文本 代码 · 共 61 行
TXT
61 行
--===BBS水木清华站∶精华区===--
-===BBS水木清华站∶精华区===-
------------------------------------------
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水木清华站∶精华区===-
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?