分割窗口

 
1、  在MainFrm.h中定义成员变量
CDialogBar m_wndShowStatus;
CDialogBar m_wndShowStatus2;
CButton* m_StartDeviceButton;
2、  在MainFrm.cpp的OnCreate()函数中
//添加上部的对话框*****************************
    if (!m_wndShowStatus.Create(this, IDD_TOP,
        CBRS_RIGHT | CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_HIDE_INPLACE,IDD_TOP))
    {
        TRACE0("Failed to create dialog bar m_wndShowStatus/n");
        return -1;       // fail to create
    }
 
    m_wndShowStatus.EnableDocking(CBRS_ALIGN_RIGHT | CBRS_ALIGN_LEFT);
    EnableDocking(CBRS_ALIGN_ANY);
    DockControlBar(&m_wndShowStatus,AFX_IDW_DOCKBAR_TOP,NULL);//后面两个参数可以不写
//添加下部的对话框*****************************
    if (!m_wndShowStatus2.Create(this, IDD_BOTTOM,
        CBRS_RIGHT | CBRS_BOTTOM | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_HIDE_INPLACE,IDD_BOTTOM))
    {
        TRACE0("Failed to create dialog bar m_wndShowStatus2/n");
        return -1;       // fail to create
    }
 
    m_wndShowStatus2.EnableDocking(CBRS_ALIGN_RIGHT | CBRS_ALIGN_LEFT);
    EnableDocking(CBRS_ALIGN_ANY);
    DockControlBar(&m_wndShowStatus2,AFX_IDW_DOCKBAR_BOTTOM,NULL);
1、  用Spliter划分,在MainFrm.h中
public:
    CSplitterWnd m_wndSplitter;
    CSplitterWnd m_wndSplitter2;
    CSplitterWnd m_wndSplitter3;
    CDialogBar m_wndShowStatus;
    CDialogBar m_wndShowStatus1;   
    CDialogBar m_wndSetupDlg;
protected:
    virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
2、  在MainFrm.cpp的OnCreateClient()函数中
BOOL CADFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
    // TODO: Add your specialized code here and/or call the base class
    if (!m_wndSplitter.CreateStatic(this, 1, 2)) // 创建1行2列分割
    {
        TRACE0("Failed to CreateStaticSplitter/n");
        return FALSE;
    }
   
    if (!m_wndSplitter.CreateView(0, 0,
        RUNTIME_CLASS(CADDigitView), CSize(350, 50), pContext))
    {//数字列表创建显示
        TRACE0("Failed to create first pane/n");
        return FALSE;
    }
   
    // 对第2列进行再分割
    if (!m_wndSplitter2.CreateStatic(
        &m_wndSplitter,     // our parent window is the first splitter
        3, 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;
    }
   
    int cyText = max(lpcs->cy, 20);    // height of text pane
   
    if (!m_wndSplitter2.CreateView(0, 0,
        RUNTIME_CLASS(CADFlagView), CSize(0, 100), pContext))
    {
        TRACE0("Failed to create second pane/n");
        return FALSE;
    }
   
    if (!m_wndSplitter2.CreateView(1, 0,
        RUNTIME_CLASS(CADWaveView), CSize(0, 420), pContext))
    {
        TRACE0("Failed to create second pane/n");
        return FALSE;
    }
    if (!m_wndSplitter2.CreateView(2, 0,
        RUNTIME_CLASS(CADSaveView), CSize(0, 100), pContext))
    {
        TRACE0("Failed to create third pane/n");
        return FALSE;
    }
    return TRUE;
   
} 

你可能感兴趣的:(null,Class,dialog,border,nested)