CSplitterWnd分割窗口运行时出错解决方法

CSplitterWnd分割窗口运行时出错
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
return m_wndSplitter.Create(this,
2, 2,               // TODO: adjust the number of rows, columns
CSize(10, 10),      // TODO: adjust the minimum pane size
pContext);
}
这段代码把窗口分割成2行,2列,如果我想分成4行4列,就把上面的,2,2,改为,4,4了,可以编译通过,可是运行的时候就出错,请问如何解决,谢谢
------解决方案--------------------
能开一个窗口,把窗口分成左右两部分,然后在每一部分里画个圈
这是VC的例子Viewex中的代码。
BOOL C3WaySplitterFrame::OnCreateClient(LPCREATESTRUCT lpcs,
  CCreateContext* pContext)
{
 // create a splitter with 1 row, 2 columns
 if (!m_wndSplitter.CreateStatic(this, 1, 2))
 {
  TRACE0("Failed to CreateStaticSplitter\n");
  return FALSE;
 }

 // add the first splitter pane - the default view in column 0
 if (!m_wndSplitter.CreateView(0, 0,
  pContext->m_pNewViewClass, CSize(200, 50), pContext))
 {
  TRACE0("Failed to create first pane\n");
  return FALSE;
 }

 // add the second splitter pane - which is a nested splitter with 2 rows
 if (!m_wndSplitter2.CreateStatic(
  &m_wndSplitter,     // our parent window is the first splitter
  2, 1,               // the new splitter is 2 rows, 1 column
  WS_CHILD 
------解决方案--------------------
 WS_VISIBLE 
------解决方案--------------------
 WS_BORDER,  // style, WS_BORDER is needed
  m_wndSplitter.IdFromRowCol(0, 1)
   // new splitter is in the first row, 2nd column of first splitter
    ))
 {
  TRACE0("Failed to create nested splitter\n");
  return FALSE;
 }

 // now create the two views inside the nested splitter
 int cyText = max(lpcs->cy - 70, 20);    // height of text pane

 if (!m_wndSplitter2.CreateView(0, 0,
  RUNTIME_CLASS(CTextView), CSize(0, cyText), pContext))
 {
  TRACE0("Failed to create second pane\n");
  return FALSE;
 }
 if (!m_wndSplitter2.CreateView(1, 0,
  RUNTIME_CLASS(CColorView), CSize(0, 0), pContext))
 {
  TRACE0("Failed to create third pane\n");
  return FALSE;
 }

 // it all worked, we now have two splitter windows which contain
 //  three different views
 return TRUE;


******************************************************
VS里面两侧的资源面板与属性面板是用的DockPane,不是用的Splitter。如果你用VS2008加SP1,或者VS2010的话,可能直接生成VS一样的框架。
追问
额,这个Frame重载OnCreateClient意义不大啊。。。其实我主要求CTextView之类的View的具体写法。
评论
------解决方案--------------------
0
2013-02-20 21:36clever_wolf
------解决方案--------------------
十四级
这是VC的例子VIEWEX代码完全按照您的要求。 
 BOOL C3WaySplitterFrame ::的OnCreateClient(LPCREATESTRUCT LPCS,
 CCreateContext * pContext)
 {
 / /创建一个分离器,有1行2列
(m_wndSplitter。 CreateStatic(这一点,1,2)){
 
 TRACE0(“到CreateStaticSplitter \ n”); 
返回FALSE; 

 
 / /添加第一个分离器窗格 - 列的默认视图0 
(m_wndSplitter.CreateView(0,0,
 pContext-> m_pNewViewClass,CSIZE(200,50),pContext)) {
 TRACE0(“未能创建第一个窗格\ n”); 
返回FALSE; 

 
 / /添加第二个分离器窗格 - 这是一个嵌套分离器(m_wndSplitter2.CreateStatic(
 m_wndSplitter,/ /?我们的父窗口的第一分2行
 
 2,1,/ /?新的分离器2行,1列
 WS_CHILD 
------解决方案--------------------
 WS_VISIBLE 
------解决方案--------------------
 WS_BORDER,/ /?的风格,WS_BORDER需要
 m_wndSplitter.IdFromRowCol(0,1)
 / /新的分离器是在第一行中,第2列的第一分
))
 {
 TRACE0(“无法创建嵌套的分离器\ n”); 
返回FALSE; 

  BR /> / /现在创建两个视图里面的嵌套分离器
诠释cyText = MAX(LPCS - > CY - 70,20); / /文本窗格的高度
 
如果(! m_wndSplitter2。CreateView的(0,0,
 RUNTIME_CLASS(CTextView)的,CSIZE(0,cyText),pContext)){
 
 TRACE0(“未能创建了第二个窗格\ n”); BR />返回FALSE;} 
 
(m_wndSplitter2.CreateView(1,0,
 RUNTIME_CLASS(CColorView)的,CSIZE(0,0),pContext))
 { 
 TRACE0(“无法创建第三个窗格\ n”); 
返回FALSE;