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 windows that are newly sized

Redrawing windows that are newly sized

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelpquestion
2 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.
  • T Offline
    T Offline
    TheDelChop
    wrote on last edited by
    #1

    Hello, I am working on a simple program that must load a bitmap and then resize the window that the bitmap is displayed in so that it is the exact size of the bitmap. The program appears to work fine, except for one small problem. When Windows redraws the window that has now been resized, the border on both the right hand side and the bottom do not get drawn. Also, it appears that the orignal "X" box that closes the program is still there. However, if I resize the window manually after the computer has redrwan the window, both borders appear and the old "X" box disappears. Anyone have any idea how I can go about fixing this problem? Thanks, Joe

    C 1 Reply Last reply
    0
    • T TheDelChop

      Hello, I am working on a simple program that must load a bitmap and then resize the window that the bitmap is displayed in so that it is the exact size of the bitmap. The program appears to work fine, except for one small problem. When Windows redraws the window that has now been resized, the border on both the right hand side and the bottom do not get drawn. Also, it appears that the orignal "X" box that closes the program is still there. However, if I resize the window manually after the computer has redrwan the window, both borders appear and the old "X" box disappears. Anyone have any idea how I can go about fixing this problem? Thanks, Joe

      C Offline
      C Offline
      Chris Richardson
      wrote on last edited by
      #2

      SetWindowPos has a flag to indicate that the non-client area of the window needs updating. You can either use SetWindowPos to do the resize (if you are not already using SetWindowPos), or you can do something like the following just to force the frame to redraw:

      // Put this after your call to MoveWindow or whatever
      SetWindowPos( Your_HWND_Here, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_DRAWFRAME );

      Good luck,

      Chris Richardson

      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