1、利用向导生成,应用程序类型“单个文档”,非“文档视图结构”的应用程序。
2、向导生成的默认视图是CView的派生类。删除所有与CView派生类相关的代码。
3、利用资源视图生成CFormView相关的派生类CMyForm。
4、在主框架中重载函数BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext),代码如下:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: 在此添加专用代码和/或调用基类
CCreateContext cx;
cx.m_pCurrentFrame = this;
cx.m_pNewViewClass = RUNTIME_CLASS(CMyForm);
return CFrameWnd::OnCreateClient(lpcs, &cx);
}
5、去掉CMyForm的边界凹凸。
BOOL CMyForm::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style &=~WS_BORDER;
return CFormView::PreCreateWindow(cs);
}