Redrawing Controls??????
-
How can i redarw controls(with changed co ordinates) in a MFC Application, once i have detected that resolution has changed??
-
How can i redarw controls(with changed co ordinates) in a MFC Application, once i have detected that resolution has changed??
Call the RedrawWindow function on the top level window with atleast the parameters RDW_INVALIDATE and RDW_ALLCHILDREN. It will step through all child windows itself and make sure every child window gets redrawn. Then again, if the resolution has changed don't all windows get a WM_PAINT message automatically?
-
Call the RedrawWindow function on the top level window with atleast the parameters RDW_INVALIDATE and RDW_ALLCHILDREN. It will step through all child windows itself and make sure every child window gets redrawn. Then again, if the resolution has changed don't all windows get a WM_PAINT message automatically?
thanx Luuk, But it doesn't seem to work. Can u elaborate on it by an example.
-
thanx Luuk, But it doesn't seem to work. Can u elaborate on it by an example.
Sure, it's quite simple:
LRESULT CMyFrameWnd::OnDisplayChange(WPARAM wParam, LPARAM lParam)
{
// cBitsPerPixel = wParam;
// cxScreen = LOWORD(lParam);
// cyScreen = HIWORD(lParam);// Redraw the window and its children RedrawWindow(NULL, NULL, RDW\_INVALIDATE | RDW\_ERASE | RDW\_ALLCHILDREN | RDW\_UPDATENOW); // Pass it on to the base class return CFrameWnd::OnDisplayChange(wParam, lParam);
}
This should do the trick, if it doesn't then I suppose something else is going on.