静态拆分窗口——三叉窗口

1.首先在CMainFrm.h中定义2个CSplitterWnd 的变量:

CSplitterWnd m_wndSplitter1;
CSplitterWnd m_wndSplitter2;

2.添加你要加载的3个子窗口的类class wizard ----add class-----新建基于cview的类CView1,CView2,CView3。

3.在CMainFrm.CPp中添加消息响应函数OnCreateClient。

4.

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

 // TODO: Add your specialized code here and/or call the base class
 // create a splitter with 2 row, 1 columns
 if (!m_wndSplitter1.CreateStatic(this, 2, 1))
 {
  TRACE0("Failed to CreateStaticSplitter/n");
  return FALSE;
 }
 int row = 500;
 m_wndSplitter1.SetRowInfo(0, row, 64);
 m_wndSplitter1.SetRowInfo(1, INFO_VIEW_HEIGHT, 64);
 // add the first splitter pane
 // which is a nested splitter with 2 columns
 if (!m_wndSplitter2.CreateStatic(
  &m_wndSplitter1,     // our parent window is the first splitter
  1, 2,               // the new splitter is 2 rows, 1 column
  WS_CHILD | WS_VISIBLE | WS_BORDER,  // style, WS_BORDER is needed
  m_wndSplitter1.IdFromRowCol(0, 0)
  // new splitter is in the first row, 2nd column of first splitter
    ))
 {
  TRACE0("Failed to create nested splitter/n");
  return FALSE;
 }
 int column = 200;
 m_wndSplitter2.SetColumnInfo(0, column, 64);
 m_wndSplitter2.SetColumnInfo(1, column, 64);

 // now create the two views inside the nested splitter
 if (!m_wndSplitter2.CreateView(0, 0,
  RUNTIME_CLASS(CView1), CSize(column, row), pContext))
 {
  TRACE0("Failed to create Tree pane/n");
  return FALSE;
 }
 

 if (!m_wndSplitter2.CreateView(0, 1,
  RUNTIME_CLASS(CView2), CSize(column, row), pContext))
 {
  TRACE0("Failed to create Edit pane/n");
  return FALSE;
 }
 if (!m_wndSplitter1.CreateView(1, 0,
  RUNTIME_CLASS(CView4), CSize(column, row), pContext))
 {
  TRACE0("Failed to create Edit pane/n");
  return FALSE;
 }
return TRUE;

即可生成上面2列,下面1列的三叉窗口界面!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值