C++/(MFC)On Sizing 윈도우 리사이징 컨트롤 크기 조정 Edit Diff Refresh Backlink Random Search History Help Setting Hide Show // 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); } } MFC Windows 이 글에는 0 개의 댓글이 있습니다. Please enable JavaScript to view the comments powered by Disqus. comments powered by Disqus