Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Redrawing Controls??????

Redrawing Controls??????

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amit sebiz
    wrote on last edited by
    #1

    How can i redarw controls(with changed co ordinates) in a MFC Application, once i have detected that resolution has changed??

    L 1 Reply Last reply
    0
    • A amit sebiz

      How can i redarw controls(with changed co ordinates) in a MFC Application, once i have detected that resolution has changed??

      L Offline
      L Offline
      Luuk Weltevreden
      wrote on last edited by
      #2

      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?

      A 1 Reply Last reply
      0
      • L Luuk Weltevreden

        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?

        A Offline
        A Offline
        amit sebiz
        wrote on last edited by
        #3

        thanx Luuk, But it doesn't seem to work. Can u elaborate on it by an example.

        L 1 Reply Last reply
        0
        • A amit sebiz

          thanx Luuk, But it doesn't seem to work. Can u elaborate on it by an example.

          L Offline
          L Offline
          Luuk Weltevreden
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups