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