1.子对话框出现在主对话框的右侧
CRect rect;
this->GetWindowRect(&rect);
rect.OffsetRect(rect.Width(), 0);
his->MoveWindow(rect, true);
//his->SetWindowPos();
his->ShowWindow(SW_SHOW);
2.主对话框移动时跟随移动
重载WM_WINDOWPOSCHANGING 事件
void CsiphoneDlg::OnWindowPosChanging(WINDOWPOS* lpwndpos)
{
CDialog::OnWindowPosChanging(lpwndpos);
// TODO: 在此处添加消息处理程序代码
CRect rect;
this->GetWindowRect(&rect);
rect.OffsetRect(rect.Width(), 0);
if(his->IsWindowVisible());
his->MoveWindow(rect, true);
}
实现需解决的问题:
子对话框初始化必须在OnInitDialog()中的ShowWindow(SW_SHOWNORMAL);之前。
Powered by Zoundry Raven