当前位置: 代码迷 >> 综合 >> MFC 对话框粘连的实现
  详细解决方案

MFC 对话框粘连的实现

热度:76   发布时间:2024-01-20 14:06:39.0

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

  相关解决方案