CView中创建CSplitterWnd
2014-11-19 14:13
417 查看
1、创建SDI程序TestViewSplitter
2、添加CLeftView、CRightView两个CView视图
3、打开CTestViewSplitterView头文件,添加定义
CSplitterWnd m_wndSplitter;
4、添加CTestViewSplitterView的WM_CREATE消息函数,添加如下代码:
if(!m_wndSplitter.CreateStatic(this,1,2))
{
return FALSE;
}
BOOL bRet = m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CLeftView), CSize(200,100), NULL);
if(!bRet)
{
TRACE0("Failed to create left user pan!");
return FALSE;
}
bRet = m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CRightView), CSize(100, 100), NULL);
if(!bRet)
{
TRACE0("Failed to create right user pan!");
return FALSE;
}
m_wndSplitter.RecalcLayout();
5、添加CTestViewSplitterView的WM_SIZE消息函数,添加如下代码:
CRect rect;
GetClientRect(&rect);
if(m_wndSplitter.GetSafeHwnd() != NULL)
{
m_wndSplitter.MoveWindow(&rect);
}
6、重新编译,执行程序!
2、添加CLeftView、CRightView两个CView视图
3、打开CTestViewSplitterView头文件,添加定义
CSplitterWnd m_wndSplitter;
4、添加CTestViewSplitterView的WM_CREATE消息函数,添加如下代码:
if(!m_wndSplitter.CreateStatic(this,1,2))
{
return FALSE;
}
BOOL bRet = m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CLeftView), CSize(200,100), NULL);
if(!bRet)
{
TRACE0("Failed to create left user pan!");
return FALSE;
}
bRet = m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CRightView), CSize(100, 100), NULL);
if(!bRet)
{
TRACE0("Failed to create right user pan!");
return FALSE;
}
m_wndSplitter.RecalcLayout();
5、添加CTestViewSplitterView的WM_SIZE消息函数,添加如下代码:
CRect rect;
GetClientRect(&rect);
if(m_wndSplitter.GetSafeHwnd() != NULL)
{
m_wndSplitter.MoveWindow(&rect);
}
6、重新编译,执行程序!
相关文章推荐
- CView中创建CSplitterWnd
- 用CSplitterWnd类创建分割窗口
- MFC使用CSplitterWnd分割窗口的创建
- C++--如何实现SDI程序使用CSplitterWnd创建的多个视图的动态地显示和关闭视图
- C++--CSplitterWnd::CreateView创建CListView创建过程的调试摘抄
- C++--CSplitterWnd::CreateView创建CListView创建过程的调试摘抄
- C++--如何实现SDI程序使用CSplitterWnd创建的多个视图的动态地显示和关闭视图
- C++--CSplitterWnd::CreateView创建CListView创建过程的调试摘抄
- 用CSplitterWnd类创建分割窗口
- C++--如何实现SDI程序使用CSplitterWnd创建的多个视图的动态地显示和关闭视图
- C++--CSplitterWnd::CreateView创建CListView创建过程的调试摘抄
- 如何实现SDI程序使用CSplitterWnd创建的多个视图的动态地显示和关闭视图
- C++--如何实现SDI程序使用CSplitterWnd创建的多个视图的动态地显示和关闭视图
- C++--CSplitterWnd::CreateView创建CListView创建过程的调试摘抄
- C++--如何实现SDI程序使用CSplitterWnd创建的多个视图的动态地显示和关闭视图
- [MFC]利用CSplitterWnd创建“品”字型界面
- vc切割子窗口(CSplitterWnd)
- 关于自定义分割窗口类(派生于CSplitterWnd)遇到的问题
- 使用CSplitterWnd实现拆分窗口(多视图显示)
- 在本人的虚拟手术项目中,实现了利用CSplitterWnd对tabView中的任意子view进行窗口切割,效果跟用CSplitterWnd对CMainFrame完全一致。 (注:本人纯粹为了记录技术,