您的位置:首页 > 其它

MFC 分隔框制作步骤

2013-03-29 09:23 197 查看
1 创建单文档

2 在父框架类中定义一个CSplitterWnd类型的成员对象。

3 创建一个基于CFormView对话框类,CDialogShow。(注意:把对话框的style设置为Child,否则你就等则界面崩溃吧)

4 重载父框架类的CFrameWnd::OnCreateClient成员函数。

5 在重载的CFrameWnd::OnCreateClient函数中调用CSplitterWnd成员对象的Create函数。

函数示例如下:

BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)

{

// TODO: Add your specialized code here and/or call the base class

if(m_splitter.CreateStatic(this,1,2)==NULL)

return FALSE;

CRect rect;

GetClientRect(rect);

m_splitter.CreateView(0, 0, RUNTIME_CLASS(CDialogShow), CSize(rect.Width()/5, 0), pContext);

m_splitter.CreateView(0, 1, RUNTIME_CLASS(CNurbsView), CSize(0, 0), pContext);

return TRUE;

}

如果编译出现:error C2143: syntax error : missing ';' before '*'

需要在C***View类前添加:class C***Doc;

代码下载:http://download.csdn.net/detail/kcpnevergiveup/5194247
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: