#keywords MFC,Windows {{{#!gcode // header RECT prevClientRect; BOOL m_bSizing; // Constructor m_bSizing = FALSE; ZeroMemory(&prevClientRect, sizeof RECT); // OnInitDialog ... GetWindowRect(&prevClientRect); ScreenToClient(&prevClientRect); m_bSizing = TRUE; ... // void CLogDialog::DockChildControl(RECT rect) { ScreenToClient(&rect); int diffBottom = rect.bottom - prevClientRect.bottom; int diffTop = rect.top - prevClientRect.top; int diffLeft = rect.left - prevClientRect.left; int diffRight = rect.right - prevClientRect.right; CRect childWndRect; // IDOK GetDlgItem(IDOK)->GetWindowRect(&childWndRect); ScreenToClient(&childWndRect); childWndRect.bottom += diffBottom; childWndRect.top += diffBottom; childWndRect.left += diffRight; childWndRect.right += diffRight; GetDlgItem(IDOK)->MoveWindow(childWndRect.left, childWndRect.top, childWndRect.Width(), childWndRect.Height()); GetDlgItem(IDOK)->RedrawWindow(); // Log List m_listLog.GetWindowRect(&childWndRect); ScreenToClient(&childWndRect); childWndRect.bottom += diffBottom; childWndRect.top += diffTop; childWndRect.left += diffLeft; childWndRect.right += diffRight; m_listLog.MoveWindow(childWndRect.left, childWndRect.top, childWndRect.Width(), childWndRect.Height()); m_listLog.RedrawWindow(); // Line GetDlgItem(IDC_STATIC_LINE)->GetWindowRect(&childWndRect); ScreenToClient(&childWndRect); childWndRect.bottom += diffBottom; childWndRect.top += diffBottom; childWndRect.left += diffLeft; childWndRect.right += diffRight; GetDlgItem(IDC_STATIC_LINE)->MoveWindow(childWndRect.left, childWndRect.top, childWndRect.Width(), childWndRect.Height()); GetDlgItem(IDC_STATIC_LINE)->RedrawWindow(); prevClientRect = rect; } void CLogDialog::OnSize(UINT nType, int cx, int cy) { CDialogEx::OnSize(nType, cx, cy); if (m_bSizing) { RECT rect; GetWindowRect(&rect); DockChildControl(rect); } } }}} ---- {{{ }}}