恐怕pContext->m_pNewViewClass做CRuntimeClass*参数是不行的:if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to create splitter bar ");
AfxMessageBox("Failed to Create Static");
return FALSE; // failed to create
}
// Get the client rect first for calc left pane size
CRect rect;
GetClientRect(&rect);
// create the left tree view first.
if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CXXView), CSize(rect.Width()/4, 0), pContext))
{
TRACE0("Failed to create left pane view\n");
AfxMessageBox("Failed to Create View");
return FALSE;
}
// The right pane is a frame which and contain several different views.
// The is can be set to active or non-active
if (!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CXXView), CSize(0, 0), pContext))
{
TRACE0("Failed to create right pane frame\n");
return FALSE;
}
return TRUE;
{
TRACE0("Failed to create splitter bar ");
AfxMessageBox("Failed to Create Static");
return FALSE; // failed to create
}
// Get the client rect first for calc left pane size
CRect rect;
GetClientRect(&rect);
// create the left tree view first.
if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CXXView), CSize(rect.Width()/4, 0), pContext))
{
TRACE0("Failed to create left pane view\n");
AfxMessageBox("Failed to Create View");
return FALSE;
}
// The right pane is a frame which and contain several different views.
// The is can be set to active or non-active
if (!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CXXView), CSize(0, 0), pContext))
{
TRACE0("Failed to create right pane frame\n");
return FALSE;
}
return TRUE;
m_wndSplitter1.SetColumnInfo(0, 150, 150);//你的初始大小,跟我当年遇到的一样
m_wndSplitter1.RecalcLayout( );
m_wndSplitter2.RecalcLayout( );
不行,请你仔细研究一下好吗?
m_wndSplitter.SetColumnInfo(0, 150, 150); //左右视的大小是SetColumnInfo
m_wndSplitter.RecalcLayout( );如果还不行,可是试一试在你的m_pNewViewClass中重载WM_SIZE
加上m_wndSplitter1.SetRowInfo(0,200,100)
试一下
我刚才调试的时候已经可以了
————
| | |
-------
| |
————