CDockablePane Usage Summary

Source: Internet
Author: User

Based on http://blog.csdn.net/kikaylee/article/details/8936953

Basic layout and usage of CDockablePane

Create a new SDI project and add an CDockablePane array to the CMainFrame class:

CDockablePane m_panes[5];//an array of CDockablePane

CMainFrame:: The following code is automatically generated in the OnCreate () function:

Enable Visual Studio 2005 Style Docking window behavior

Cdockingmanager::setdockingmode (Dt_smart);

The Visual Studio 2005 style Docking Window Auto-hide behavior

EnableAutoHidePanes (Cbrs_align_any);

EnableDocking (Cbrs_align_any);

The following add code is located after the snippet.

1.1 First case

Add CDockablePane

if (!m_panes[0]. Create ("Pane 0", This,crect (0,0,200,100), true,1000,

ws_child| ws_visible| ws_clipsiblings| ws_clipchildren| Cbrs_align_bottom| Cbrs_float_multi))

{return FALSE;}

M_panes[0]. EnableDocking (Cbrs_align_any);

DockPane (&m_panes[0]);//Left

1.2 Second case

if (!m_panes[0]. Create (_t ("Pane 0"), this, CRect (0, 0, Max, +), TRUE, 1000,

Ws_child | ws_visible | ws_clipsiblings |

Ws_clipchildren | Cbrs_left | Cbrs_float_multi))

{return FALSE;}

if (!m_panes[1]. Create (_t ("Pane 1"), this, CRect (0, 0, Max, +), TRUE, 1001,

Ws_child | ws_visible | ws_clipsiblings |

Ws_clipchildren | Cbrs_bottom | Cbrs_float_multi))

{return FALSE;}

M_panes[0]. EnableDocking (Cbrs_align_any);

M_PANES[1]. EnableDocking (Cbrs_align_any);

DockPane (&m_panes[1]);//BOTTOM, take precedence over the bottom window, the left window can only be part of

DockPane (&m_panes[0]);//Left

The first docked pane in the code takes precedence over the full side of the window. However, if you manually adjust the position of the pane, the program will read when the most recent side of the program closed pane docking position, is called the Memory interface layout. To see how the code is set, you can delete the information in the registry and then compile and run the program. When using vs debugging code, the information for the project is stored in the following location:

Hkey_current_user\software\ Application Wizard-generated local application \projectname

It should be noted that different CDockablePane call the CREATE function, its UID value must be different, because the program shuts down after the restart, will go to the registry read interface layout information, different pane location information and its UID value associated, if the two pane UID value is the same, It is possible to get an error. Msdn:specifies the-ID of the child window. This value must is unique if you want to save docking state for this docking pane.

1.3 Third case

if (!m_panes[0]. Create (_t ("Pane 0"), this, CRect (0, 0, Max, +), TRUE, 1000,

Ws_child | ws_visible | ws_clipsiblings |

Ws_clipchildren | Cbrs_left | Cbrs_float_multi))

{return FALSE;}

if (!m_panes[1]. Create (_t ("Pane 1"), this, CRect (0, 0, Max, +), TRUE, 1001,

Ws_child | ws_visible | ws_clipsiblings |

Ws_clipchildren | Cbrs_left | Cbrs_float_multi))

{return FALSE;}

M_panes[0]. EnableDocking (Cbrs_align_any);

M_PANES[1]. EnableDocking (Cbrs_align_any);

DockPane (&m_panes[0]);//Left

DockPane (&m_panes[1]);//Left

Note here, put 0 on the 1 above

M_panes[0]. Docktowindow (&m_panes[1], cbrs_top);

1.4 Fourth case

if (!m_panes[0]. Create (_t ("Pane 0"), this, CRect (0, 0, Max, +), TRUE, 1000,

Ws_child | ws_visible | ws_clipsiblings |

Ws_clipchildren | Cbrs_left | Cbrs_float_multi))

{return FALSE;}

if (!m_panes[1]. Create (_t ("Pane 1"), this, CRect (0, 0, Max, +), TRUE, 1001,

Ws_child | ws_visible | ws_clipsiblings |

Ws_clipchildren | Cbrs_left | Cbrs_float_multi))

{return FALSE;}

if (!m_panes[2]. Create (_t ("Pane 2"), this, CRect (0, 0, Max, +), TRUE, 1002,

Ws_child | ws_visible | ws_clipsiblings |

Ws_clipchildren | Cbrs_left | Cbrs_float_multi))

{return FALSE;}

M_panes[0]. EnableDocking (Cbrs_align_any);

M_PANES[1]. EnableDocking (Cbrs_align_any);

M_PANES[2]. EnableDocking (Cbrs_align_any);

DockPane (&m_panes[0]);//Left

DockPane (&m_panes[1]);//Left

DockPane (&m_panes[2]);//Left

cdockablepane* Ptabbedbar = NULL;

To the same tab and choose 1 by default

M_PANES[1]. AttachToTabWnd (&m_panes[0], dm_show, TRUE, &ptabbedbar);

To the same tab and choose 2 by default

M_PANES[2]. AttachToTabWnd (&m_panes[0], dm_show, TRUE, &ptabbedbar);

Or

To the same tab and choose 1 by default

M_PANES[1]. AttachToTabWnd (&m_panes[0], dm_show, TRUE, &ptabbedbar);

cdockablepane* pTabbedBar1 = NULL;

To the same tab and choose 2 by default

M_PANES[2]. AttachToTabWnd (PTABBLEDBAR,DM_SHOW,TRUE,&PTABBLEDBAR1);

1.5 Fifth case

if (!m_panes[0]. Create (_t ("Pane 0"), this, CRect (0, 0, Max, +), TRUE, 1000,

Ws_child | ws_visible | ws_clipsiblings |

Ws_clipchildren | Cbrs_bottom | Cbrs_float_multi))

{return FALSE;}

if (!m_panes[1]. Create (_t ("Pane 1"), this, CRect (0, 0, Max, +), TRUE, 1001,

Ws_child | ws_visible | ws_clipsiblings |

Ws_clipchildren | Cbrs_bottom | Cbrs_float_multi))

{return FALSE;}

if (!m_panes[2]. Create (_t ("Pane 2"), this, CRect (0, 0, Max, +), TRUE, 1002,

Ws_child | ws_visible | ws_clipsiblings |

Ws_clipchildren | Cbrs_left | Cbrs_float_multi))

{return FALSE;}

if (!m_panes[3]. Create (_t ("Pane 3"), this, CRect (0, 0, Max, +), TRUE, 1003,

Ws_child | ws_visible | ws_clipsiblings |

Ws_clipchildren | Cbrs_left | Cbrs_float_multi))

{return FALSE;}

if (!m_panes[4]. Create (_t ("Pane 4"), this, CRect (0, 0, Max, +), TRUE, 1004,

Ws_child | ws_visible | ws_clipsiblings |

Ws_clipchildren | Cbrs_right | Cbrs_float_multi))

{return FALSE;}

M_panes[0]. EnableDocking (Cbrs_align_any);

M_PANES[1]. EnableDocking (Cbrs_align_any);

M_PANES[2]. EnableDocking (Cbrs_align_any);

M_PANES[3]. EnableDocking (Cbrs_align_any);

M_PANES[4]. EnableDocking (Cbrs_align_any);

DockPane (&m_panes[0]);//BOTTOM

DockPane (&m_panes[1]);//BOTTOM

DockPane (&m_panes[2]);//Left

DockPane (&m_panes[3]);//Left

DockPane (&m_panes[4]);//Right

cdockablepane* Ptabbedbar = NULL;

M_panes[0]. Docktowindow (&m_panes[1], cbrs_left);

M_PANES[3]. AttachToTabWnd (&m_panes[2], dm_show, TRUE, &ptabbedbar);

CDockablePane Usage Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.