您的位置:首页 > 其它

MFC对单文档进行窗口分割。

2016-02-25 13:53 302 查看
新建单文档工程,在MainFrm.cpp中添加虚函数OnCreateClicent();

1、在虚函数中添加代码:

BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: 在此添加专用代码和/或调用基类

CRect rect;
GetClientRect(&rect);
m_wndSplitter.CreateStatic(this,1,2);//静态分割<span style="white-space:pre">	</span>
int cx = max(10,(rect.Width()-50))/2;
int cy = rect.Height();
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CSwitchFormView),CSize(cx,cy),pContext)//第一视图类View
m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CLastFormView),CSize(cx,cy),pContext);//第二视图类View</span>

return TRUE;
//return CFrameWndEx::OnCreateClient(lpcs, pContext);
}</span>


2、在头文件MainFrm.h中添加:

// 特性

public:

CSplitterWnd m_wndSplitter;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: