先贴出代码吧,很简单
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
CRect rct;
GetClientRect(&rct);
CSize size = rct.Size();
size.cx /= 2;
size.cy /= 2; // 创建拆分窗口
if (!m_wndSplitter.CreateStatic(this, 1, 2))
return FALSE; // Create main drawing view
m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CTestView), size, pContext); // Create left splitter window
if (!m_wndLeftSplitter.CreateStatic(&m_wndSplitter, 2, 1,
WS_CHILD | WS_VISIBLE, m_wndSplitter.IdFromRowCol(0, 0)))
return FALSE; // Create Tv
m_wndLeftSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), size, pContext);
// Create Lv
m_wndLeftSplitter.CreateView(1, 0, RUNTIME_CLASS(CEqmLv), size, pContext); return TRUE;
}此为SDI工程
CEqmLv继承自CListView。
我想要的结果是:竖直切割器m_wndSplitter将Frame分为左右两部分,右边放CTestView(派生自CView),水平切割器m_wndLeftSplitter将左边分为上下两部分,上边放CLeftView(派生自CTreeView),下边放CEqmLv。上述代码确实能分隔成功,问题是:程序运行起来时,CLeftView和CEqmLv的宽度都很小,将近0,宽度并不是我想要的size.cx大小,只能手工拖动竖直分割条,才能看见CLeftView和CEqmLv,而右边的CTestView是全屏大小。
热心的兄弟给说说,是怎么回事,如何才能达到我想要的效果,谢谢,在线等
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
CRect rct;
GetClientRect(&rct);
CSize size = rct.Size();
size.cx /= 2;
size.cy /= 2; // 创建拆分窗口
if (!m_wndSplitter.CreateStatic(this, 1, 2))
return FALSE; // Create main drawing view
m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CTestView), size, pContext); // Create left splitter window
if (!m_wndLeftSplitter.CreateStatic(&m_wndSplitter, 2, 1,
WS_CHILD | WS_VISIBLE, m_wndSplitter.IdFromRowCol(0, 0)))
return FALSE; // Create Tv
m_wndLeftSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), size, pContext);
// Create Lv
m_wndLeftSplitter.CreateView(1, 0, RUNTIME_CLASS(CEqmLv), size, pContext); return TRUE;
}此为SDI工程
CEqmLv继承自CListView。
我想要的结果是:竖直切割器m_wndSplitter将Frame分为左右两部分,右边放CTestView(派生自CView),水平切割器m_wndLeftSplitter将左边分为上下两部分,上边放CLeftView(派生自CTreeView),下边放CEqmLv。上述代码确实能分隔成功,问题是:程序运行起来时,CLeftView和CEqmLv的宽度都很小,将近0,宽度并不是我想要的size.cx大小,只能手工拖动竖直分割条,才能看见CLeftView和CEqmLv,而右边的CTestView是全屏大小。
热心的兄弟给说说,是怎么回事,如何才能达到我想要的效果,谢谢,在线等
解决方案 »
- 请教高手:ActiveX控件内能否插入已经做好的窗口?
- 在VC中播放ppt文件
- 求助:对于 屏蔽 右键弹出菜单 中某命令
- 怎么把图片里指定的颜色替换成另一个指定的颜色?请高手指点!!
- ado连接sql server,数据类型转换问题
- 在ATL中怎么使用MFC库,例如CRecordset?或者在MFC ActiveX ControlWizard中能创建简单的COM对象吗?
- 活动窗口图象压缩问题!
- 是否可以动态的添加多个ComboBox控件到程序中指定的不同位置呢?
- 怎么设置CTIME变量的时分秒为0啊?
- com使用的问题
- 关于WideCharToMultiByte来解码UTF8
- GetProcAddress中函数明加'_T'之后无法获取,GetLasterError为127
http://www.vckbase.com/document/viewdoc/?id=192 应该可以达到你的效果了!
m_wndSplitter.SetColumnInfo(1,右宽度,0);
m_wndLeftSplitter.SetRowInfo(0,上高度,0);
m_wndLeftSplitter.SetRowInfo(0,下高度,0);
我刚在项目里面的写的,左面一个,有面三个的
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
if(m_wndSplitter1.CreateStatic(this,1,2)==NULL)
return FALSE;
CRect rect;
this->GetClientRect(rect);
// if (!m_wndSplitter1.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext) ||
// !m_wndSplitter1.CreateView(0, 1, RUNTIME_CLASS(CRightFrame), CSize(100, 100), pContext))
// {
// m_wndSplitter.DestroyWindow();
// return FALSE;
// }
m_wndSplitter1.CreateView(0,0,RUNTIME_CLASS(CLeftView),CSize((int)(rect.Width() * 0.18),0),pContext); if(m_wndSplitter2.CreateStatic(&m_wndSplitter1,3,1,WS_CHILD|WS_VISIBLE,
m_wndSplitter1.IdFromRowCol(0, 1))==NULL)
return FALSE; m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS(CRightUpView),CSize(20,35),pContext);
m_wndSplitter2.CreateView(1,0,RUNTIME_CLASS(CListCtrlView),CSize(300,(int)(rect.Height() * 0.3)),pContext);
m_wndSplitter2.CreateView(2,0,RUNTIME_CLASS(CRightBtView),CSize(300,100),pContext);
leftview = (CLeftView*)m_wndSplitter1.GetPane (0, 0) ;
rightframe = (CRightFrame*)m_wndSplitter1.GetPane (0, 1) ;
}
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
if(m_wndSplitter1.CreateStatic(this,1,2)==NULL)
return FALSE;
CRect rect;
this->GetClientRect(rect);
m_wndSplitter1.CreateView(0,0,RUNTIME_CLASS(CLeftView),CSize((int)(rect.Width() * 0.18),0),pContext); if(m_wndSplitter2.CreateStatic(&m_wndSplitter1,3,1,WS_CHILD|WS_VISIBLE,
m_wndSplitter1.IdFromRowCol(0, 1))==NULL)
return FALSE; m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS(CRightUpView),CSize(20,35),pContext);
m_wndSplitter2.CreateView(1,0,RUNTIME_CLASS(CListCtrlView),CSize(300,(int)(rect.Height() * 0.3)),pContext);
m_wndSplitter2.CreateView(2,0,RUNTIME_CLASS(CRightBtView),CSize(300,100),pContext);
leftview = (CLeftView*)m_wndSplitter1.GetPane (0, 0) ;
rightframe = (CRightFrame*)m_wndSplitter1.GetPane (0, 1) ;
}