www.gusucode.com > 含多种窗体元素的VC++演示对话框-源码程序 > 含多种窗体元素的VC++演示对话框-源码程序/code/MyDialog.cpp
// MyDialog.cpp: Implementierungsdatei // Download by http://www.NewXing.com #include "stdafx.h" #include "LayoutManager.h" #include "MyDialog.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // Dialogfeld CMyDialog CMyDialog::CMyDialog(CWnd* pParent /*=NULL*/) : CDialogMgr(CMyDialog::IDD, pParent) { //{{AFX_DATA_INIT(CMyDialog) // HINWEIS: Der Klassen-Assistent f黦t hier Elementinitialisierung ein //}}AFX_DATA_INIT } void CMyDialog::DoDataExchange(CDataExchange* pDX) { CDialogMgr::DoDataExchange(pDX); //{{AFX_DATA_MAP(CMyDialog) // HINWEIS: Der Klassen-Assistent f黦t hier DDX- und DDV-Aufrufe ein //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CMyDialog, CDialogMgr) //{{AFX_MSG_MAP(CMyDialog) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen f黵 Nachrichten CMyDialog BOOL CMyDialog::OnInitDialog() { CDialogMgr::OnInitDialog(); /* DialogMgr: Add this: */ // See article for comments // define the Layout CPane *newItemPane=new CPane ( this, HORIZONTAL ); newItemPane->addItem ( IDC_NEW_ITEM, GREEDY ); newItemPane->addItem ( IDC_ADD_ITEM, NORESIZE ); CPane *bottomPane=new CPane ( this, HORIZONTAL ); bottomPane->addItem ( paneNull, GREEDY ); bottomPane->addItem ( IDOK, NORESIZE ); bottomPane->addItem ( IDCANCEL, NORESIZE ); m_pRootPane=new CPane ( this, VERTICAL ); m_pRootPane->addItem ( IDC_NEW_ITEM_STATIC, NORESIZE ); m_pRootPane->addPane ( newItemPane, ABSOLUTE_VERT ); m_pRootPane->addItem ( IDC_ITEM_LIST_STATIC, NORESIZE ); m_pRootPane->addItem ( IDC_ITEM_LIST, GREEDY ); m_pRootPane->addPane ( bottomPane, ABSOLUTE_VERT ); UpdateLayout (); /************************/ return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zur點kgeben } // Only horizontally sizable //////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Dialogfeld CMyDialogHorz CMyDialogHorz::CMyDialogHorz(CWnd* pParent /*=NULL*/) : CDialogMgr(CMyDialogHorz::IDD, pParent) { //{{AFX_DATA_INIT(CMyDialogHorz) // HINWEIS: Der Klassen-Assistent f黦t hier Elementinitialisierung ein //}}AFX_DATA_INIT } void CMyDialogHorz::DoDataExchange(CDataExchange* pDX) { CDialogMgr::DoDataExchange(pDX); //{{AFX_DATA_MAP(CMyDialogHorz) // HINWEIS: Der Klassen-Assistent f黦t hier DDX- und DDV-Aufrufe ein //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CMyDialogHorz, CDialogMgr) //{{AFX_MSG_MAP(CMyDialogHorz) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen f黵 Nachrichten CMyDialogHorz BOOL CMyDialogHorz::OnInitDialog() { CDialogMgr::OnInitDialog(); /* DialogMgr: Add this: */ // See article for comments // define the Layout CPane *newItemPane=new CPane ( this, HORIZONTAL ); newItemPane->addItem ( IDC_NEW_ITEM, GREEDY ); newItemPane->addItem ( IDC_ADD_ITEM, NORESIZE ); CPane *bottomPane=new CPane ( this, HORIZONTAL ); bottomPane->addItem ( paneNull, GREEDY ); bottomPane->addItem ( IDOK, NORESIZE ); bottomPane->addItem ( IDCANCEL, NORESIZE ); m_pRootPane=new CPane ( this, VERTICAL ); m_pRootPane->addItem ( IDC_NEW_ITEM_STATIC, NORESIZE ); m_pRootPane->addPane ( newItemPane, ABSOLUTE_VERT ); m_pRootPane->addItem ( IDC_ITEM_LIST_STATIC, NORESIZE ); // This line is the difference to CMyDialog !!! m_pRootPane->addItem ( IDC_ITEM_LIST, ABSOLUTE_VERT ); m_pRootPane->addPane ( bottomPane, ABSOLUTE_VERT ); UpdateLayout (); /************************/ return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zur點kgeben }