+ -
当前位置:首页 → 问答吧 → 怎样把formview 绑定到Splitter分的区域内显示?

怎样把formview 绑定到Splitter分的区域内显示?

时间:2011-11-26

来源:互联网


BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
// TODO: Add your specialized code here and/or call the base class

//创建一个静态分栏窗口,分为2行1列 
if(wndSplitter_horizontal.CreateStatic(this,2,1)==NULL) 
return FALSE;

   //将CMonitorTopView视图连接到0行0列窗格上
   wndSplitter_horizontal.CreateView(0,0,RUNTIME_CLASS(CMonitorTopView),CSize(50,50),pContext);
   
  
    //将第1行0列再分开1行2列
    if(wndSplitter_erect.CreateStatic(&wndSplitter_horizontal,1,2,WS_CHILD|WS_VISIBLE, wndSplitter_horizontal.IdFromRowCol(1, 0))==NULL)
    
    return FALSE; 
   
     //将CMonitorView类连接到第二个分栏对象的0行0列
     wndSplitter_erect.CreateView(0,0,RUNTIME_CLASS(CMonitorView),CSize(220,220),pContext);
     
     //将CMonitorRightView类连接到第二个分栏对象的0行1列
     wndSplitter_erect.CreateView(0,1,RUNTIME_CLASS(CMonitorRightView),CSize(220,220),pContext); 
    
      return TRUE;


//return CFrameWnd::OnCreateClient(lpcs, pContext);
}
CMonitorTopView、CMonitorView和CMonitorRightView是已有的view窗体。

http://apps.hi.baidu.com/share/detail/661011
上面是我按着做的例子,但做完之后,所分出的区域都是空白的,不是显示view里的内容。是我程序的问题,还是少显示语句呀!感谢呀!!

作者: tflb   发布时间: 2011-11-26

参考我的“ChangeSplit.zip”

作者: schlafenhamster   发布时间: 2011-11-26

CMonitorTopView、CMonitorView和CMonitorRightView

在这几个的view中,你是否都写了数据哪??有没有初始化哪???

作者: shen_wei   发布时间: 2011-11-26

从程序上看,没有什么问题啊。单步调试下,看看两个CreateStatic有没有成功,还有在资源编辑器中把所有的FormView类模板资源设置child和no border属性。

作者: uC_Fly   发布时间: 2011-11-26