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. forcing window repaint

forcing window repaint

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsquestion
3 Posts 3 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
    TimWallace
    wrote on last edited by
    #1

    This is driving me nuts! In one of my windows, I want to bitblt a particular bitmap when the mouse is over a given region. Everything works except the window repainting itself. The region in question is at one edge of the window. If I mouse over that region, then go off the window and click the window under it and then bring my window back to the front, the bitmap has been blitted. In a nutshell, I do the following: - in response to WM_MOUSEMOVE I test to see if in the region; if so, I set a flag. I invalidate that rectangle and do an UpdateWindow to force a WM_PAINT - in response to WM_PAINT, I call my function that does the blitting of the bmp. Is there something special about drawing on a window that I'm missing?! things could always be worse...

    J L 2 Replies Last reply
    0
    • T TimWallace

      This is driving me nuts! In one of my windows, I want to bitblt a particular bitmap when the mouse is over a given region. Everything works except the window repainting itself. The region in question is at one edge of the window. If I mouse over that region, then go off the window and click the window under it and then bring my window back to the front, the bitmap has been blitted. In a nutshell, I do the following: - in response to WM_MOUSEMOVE I test to see if in the region; if so, I set a flag. I invalidate that rectangle and do an UpdateWindow to force a WM_PAINT - in response to WM_PAINT, I call my function that does the blitting of the bmp. Is there something special about drawing on a window that I'm missing?! things could always be worse...

      J Offline
      J Offline
      Joaquin M Lopez Munoz
      wrote on last edited by
      #2

      ...I invalidate that rectangle and do an UpdateWindow to force a WM_PAINT Try (for debugging purposes) invalidating the whole window instead. If this causes the window to be correctly repainted, then probably you're miscalculating the dimensions of the rectangle. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

      1 Reply Last reply
      0
      • T TimWallace

        This is driving me nuts! In one of my windows, I want to bitblt a particular bitmap when the mouse is over a given region. Everything works except the window repainting itself. The region in question is at one edge of the window. If I mouse over that region, then go off the window and click the window under it and then bring my window back to the front, the bitmap has been blitted. In a nutshell, I do the following: - in response to WM_MOUSEMOVE I test to see if in the region; if so, I set a flag. I invalidate that rectangle and do an UpdateWindow to force a WM_PAINT - in response to WM_PAINT, I call my function that does the blitting of the bmp. Is there something special about drawing on a window that I'm missing?! things could always be worse...

        L Offline
        L Offline
        lucy 0
        wrote on last edited by
        #3

        also, you might want to track WM_MOUSELEAVE message. here is a snip to how to get this message:

            // we want to know when the mouse is leaving
            TRACKMOUSEEVENT structEventTrack;
            structEventTrack.cbSize = sizeof(structEventTrack);
            structEventTrack.dwFlags = TME\_LEAVE;
            structEventTrack.hwndTrack = this->GetSafeHwnd();
            structEventTrack.dwHoverTime = HOVER\_DEFAULT; // this is not used, though
        
            \_TrackMouseEvent(&structEventTrack); // we want to receive WM\_MOUSELEAVE message
        

        and in your handler to WM_MOUSELEAVE message, you might want to clear your flags which was set during mousemove.

        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