If you have added controls such as ctoolbar or cstatusbar in the dialog box, the original UI will be affected. You can write a function to relay the window layout. As follows:
void CMsgManagementDialog::AdjustWindow(CDialog *pParent){ASSERT(pParent != NULL);ASSERT(pParent->IsKindOf(RUNTIME_CLASS(CDialog)));CRect rectClientStart;CRect rectClientNow;pParent->GetClientRect(rectClientStart);pParent->RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposQuery, rectClientNow);CPoint ptOffset(rectClientNow.left-rectClientStart.left, rectClientNow.top-rectClientStart.top);CRect rectChild;CWnd *pWndChild = pParent->GetWindow(GW_CHILD);while(pWndChild){pWndChild->GetWindowRect(rectChild);pParent->ScreenToClient(rectChild);rectChild.OffsetRect(ptOffset);pWndChild->MoveWindow(rectChild, FALSE);pWndChild = pWndChild->GetNextWindow();}CRect rectWindow;pParent->GetWindowRect(rectWindow);rectWindow.right += rectClientStart.Width()-rectClientNow.Width();rectWindow.bottom += rectClientStart.Height()-rectClientStart.Height();pParent->MoveWindow(rectWindow, FALSE);pParent->RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);pParent->CenterWindow();}