简体   繁体   English

如何使CMDIChildWnd在MFC中可停靠?

[英]How to Make CMDIChildWnd as Dockable in MFC?

I want to Make CMDIChildWnd as Dockable.... My Code which Create Window Frame While click on ribbon Button and I want Docking all window in tabbed format, when i place Drag My Frame is show Docking Manager Format[DT_SMART]... 我想将CMDIChildWnd设置为可停靠的...。创建窗框的代码在单击功能区按钮时,我希望将所有窗口停靠在选项卡格式中,当我放置“拖动我的框”时,显示停靠管理器格式[DT_SMART] ...

This Code is Button Click event create multiple Frame.... 此代码是按钮单击事件,创建多个框架。

    pDocTemplate_New1 = new CMultiDocTemplate ( IDR_RiboonCFormViewTYPE, 
                RUNTIME_CLASS(CRiboonCFormViewTestDoc),
                RUNTIME_CLASS(CChildFrame), // custom MDI child frame
                RUNTIME_CLASS(CDepartement));
    AfxGetApp () -> AddDocTemplate (pDocTemplate_New1); 

    // Create a new child window 
    CMDIChildWnd * pMDIActive = MDIGetActive (); // get the pointer of the currently active child window 
    //CDocument * pDoc = (CDocument *) pMDIActive-> GetActiveDocument (); // get the document pointer 
    CMDIChildWnd * pNewFrame = (CMDIChildWnd *) (pDocTemplate_New1 -> CreateNewFrame (NULL, NULL));
    pNewFrame->EnableDocking(CBRS_ALIGN_ANY);
    EnableDocking(CBRS_ALIGN_ANY);
    // Create a new frame window 
    if (pNewFrame == NULL) 
    { 
        AfxMessageBox("new window can not be established ", MB_OK, 0); 
    } 
    pDocTemplate_New1 -> InitialUpdateFrame (pNewFrame, NULL); // display window 
    MDITile (MDITILE_HORIZONTAL); // tile multiple windows 
  1. Create a dockable pane first, To create a dockable pane you must first derive from the CMDIFrameWndEx . 首先创建一个可停靠窗格,要创建一个可停靠窗格,您必须首先从CMDIFrameWndEx派生。
  2. Add that pane member in CMainFrame CMainFrame添加该窗格成员
  3. Styles that matter, CBRS_FLOAT_MULTI make the dockable pane float as a unit when attached to a tab. 重要的样式CBRS_FLOAT_MULTI使可停靠窗格在附着到选项卡时作为一个单元浮动。 An alignment style like CBRS_LEFT gives the pane the initial alignment. 诸如CBRS_LEFT的对齐样式为窗格提供了初始对齐。
  4. Tabbed pane is a concept of docking panes to each other to form a regular tab control with individual panes inside. 选项卡式窗格是将窗格彼此停靠在一起以形成一个内部包含各个窗格的常规选项卡控件的概念。 Use AttachToTabWnd () to add your pane 使用AttachToTabWnd ()添加窗格

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM