BOOL CViewDialog::OnInitDialog() { // Set the Icon SetIconLarge(IDW_MAIN); SetIconSmall(IDW_MAIN); // Attach CWnd objects to the dialog items AttachItem(IDC_BUTTON1, m_Button); AttachItem(IDC_CHECK1, m_CheckA); AttachItem(IDC_CHECK2, m_CheckB); AttachItem(IDC_CHECK3, m_CheckC); AttachItem(IDC_RADIO1, m_RadioA); AttachItem(IDC_RADIO2, m_RadioB); AttachItem(IDC_RADIO3, m_RadioC); AttachItem(IDC_RICHEDIT1, m_RichEdit1); AttachItem(IDC_RICHEDIT2, m_RichEdit2); // Put some text in the edit boxes m_RichEdit1.SetWindowText(_T("Rich Edit Window")); m_RichEdit2.SetWindowText(_T("Rich Edit Window")); // Initialize dialog resizing m_Resizer.Initialize( this, CRect(0, 0, 300, 200) ); m_Resizer.AddChild(m_RadioA, topleft, 0); m_Resizer.AddChild(m_RadioB, topleft, 0); m_Resizer.AddChild(m_RadioC, topleft, 0); m_Resizer.AddChild(m_Button, topleft, 0); m_Resizer.AddChild(m_CheckA, bottomright, 0); m_Resizer.AddChild(m_CheckB, bottomright, 0); m_Resizer.AddChild(m_CheckC, bottomright, 0); m_Resizer.AddChild(m_RichEdit1, topright, RD_STRETCH_WIDTH); m_Resizer.AddChild(m_RichEdit2, bottomleft, RD_STRETCH_WIDTH| RD_STRETCH_HEIGHT); return true; }
BOOL CMyDialog::OnInitDialog() { // Set the Icon SetIconLarge(IDW_MAIN); SetIconSmall(IDW_MAIN); // Put some text in the edit boxes SetDlgItemText(IDC_EDIT1, _T("Edit Control")); SetDlgItemText(IDC_RICHEDIT1, _T("Rich Edit Window")); // Put some text in the list box AttachItem(IDC_LIST1, m_ListBox); for (int i = 0 ; i < 8 ; i++) m_ListBox.AddString(_T("List Box")); // Turn our button into a MyButton object AttachItem(IDC_BUTTON2, m_Button); // Turn our static control into a hyperlink AttachItem(IDC_STATIC4, m_Hyperlink); return TRUE; }