同时移动多个窗体时,如果用MoveWindow(),常会出现闪烁的情况。
用
HDWP hDWP = BeginDeferWindowPos(3);
hDWP = ::DeferWindowPos(hDWP,m_hWnd1, NULL, rcRight.left, rcRight.top, rcRight.right - rcRight.left ,rcRight.bottom - rcRight.top,SWP_SHOWWINDOW | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOZORDER);
hDWP = ::DeferWindowPos(hDWP,m_hWnd2, NULL, rcLeftButton.left, rcLeftButton.top, rcLeftButton.right - rcLeftButton.left ,rcLeftButton.bottom - rcLeftButton.top, SWP_SHOWWINDOW | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOZORDER);
hDWP = ::DeferWindowPos(hDWP,m_hWnd3, NULL, rcLeftTop.left, rcLeftTop.top, rcLeftTop.right - rcLeftTop.left ,rcLeftTop.bottom - rcLeftTop.top,SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER);
EndDeferWindowPos(hDWP)
其移动只能是同级别的窗体。
还要注意处理其中的重画及WM_ERASEBKGND事件的处理。