BOOL CMyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
......
InitChildWindows();
return TRUE; // return TRUE unless you set the focus to a control
}
void CMyDlg::InitChildWindows()
{
CRect rc,childrec;
CWnd* pItem = GetDlgItem(IDC_Groupbox);
pItem->GetWindowRect(&rc); //获得IDC_Groupbox控件的rect大小
//初始化窗口1
m_DlgLogin.Create(IDD_DIALOG1,pItem);
m_DlgLogin.GetWindowRect(&childrec);
m_DlgLogin.SetWindowPos(GetParent(),2,8,
(childrec.right-childrec.left), (childrec.bottom-childrec.top),0);
m_DlgLogin.ShowWindow(SW_HIDE);
}
void CMenuDlg::ShowHideWindows(int iNdex)
{
m_commudlg.ShowWindow(SW_HIDE); //ID 1
//m_DlgInput.ShowWindow(SW_HIDE); //id 2
//.........
switch (iNdex)
{
case 1:
m_commudlg.ShowWindow(SW_SHOW);
break;
case 2:
//m_DlgInput.ShowWindow(SW_SHOW);
break;
}
}
void CMenuDlg::OnBnClickedCommu()
{
// TODO: 在此添加控件通知处理程序代码
this->ShowHideWindows(1);
}
VS2013
外观:Border--(细)Thin
Style --(子类)Child
System Menu --False
Title Bar -- False