LRESULT CMainFrame::OnEnterSizeMove(WPARAM wParam, LPARAM lParam)
{
CRect r;
m_View->GetClientRect(r);
CString s;
s.Format("%d x %d\n", r.Width(), r.Height());
SetMessageText(s); // must do all the above in OnSize too, but only if window is visible
return(TRUE);
}
LRESULT CMainFrame::OnExitSizeMove(WPARAM wParam, LPARAM lParam)
{
SetMessageText(AFX_IDS_IDLEMESSAGE);
return(TRUE);
}
Note that this only works if the system property "show window contents while dragging" is set. Otherwise you only see the initial size, because WM_SIZE isn't sent until the drag ends. WM_SIZING *is* sent, but it doesn't help, because it passes us the size of the frame, whereas we want the size of the view. Oddly, there seems to be no way to determine the client area that would result from a given window size. CalcWindowRect does the reverse: it gives us the size of the window needed for a given client area.
No comments:
Post a Comment