접기
#include "DialogMgr.h"
class CLayoutManagerView : public CFormViewMgr
{
protected: // create from serialization only
CLayoutManagerView();
DECLARE_DYNCREATE(CLayoutManagerView)
// {
DECLARE_LAYOUT();
// }
public:
//{{AFX_DATA(CLayoutManagerView)
enum{ IDD = IDD_LAYOUTMANAGER_FORM };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
...
};
void CLayoutManagerView::OnInitialUpdate()
{
CFormViewMgr::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
// {
/* DialogMgr: Add this: */
// We want to have a disign like this
// ---------------------------
// | ---------- ---------- |
// | | Button 1 | | Button 2 | | Pane1
// | ---------- ---------- |
// ---------------------------
// ---------------------------
// | ---------- ---------- |
// | | Button 3 | | Button 4 | | Pane2
// | ---------- ---------- |
// ---------------------------
// ---------------------------
// | ----------------------- |
// | | Text | | Pane 3
// | ----------------------- |
// ---------------------------
CPane* pPane1 = new CPane ( this, HORIZONTAL );
// Add Button 1+2 to the first pane
pPane1->addItem ( IDC_BUTTON1, GREEDY );
pPane1->addItem ( IDC_BUTTON2, GREEDY );
CPane* pPane2 = new CPane ( this, HORIZONTAL );
// Add Button 3+4 to the second pane
pPane2->addItem ( IDC_BUTTON3, GREEDY );
pPane2->addItem ( IDC_BUTTON4, GREEDY );
CPane* pPane3 = new CPane ( this, HORIZONTAL );
// Add Text to the third pane, no resizing vertically!
pPane3->addItem ( IDC_STATIC_TEXT, ABSOLUTE_VERT );
// Add all the Panes to the Root
m_pRootPane=new CPane ( this, VERTICAL );
m_pRootPane->addPane ( pPane1 );
m_pRootPane->addPane ( pPane2 );
m_pRootPane->addPane ( pPane3, ABSOLUTE_VERT );
// Do the real layouting
UpdateLayout ();
/************************/
// }
}
접기