I have a sprite animation that stores the background of the window it uses and want to know how to check for the window being resized? I have tried onSizing but it only gets called at the end of the program. I would like code to be called when the user drags the window to a new size or uses the maximise or restore buttons.
In the CFrameWnd subclass constructor I use this code to create a memory dc for the entire window:
paintBmp.CreateCompatibleBitmap(GetDC(), clientRect.Width(), clientRect.Height());
paintBuffer.SelectObject( &paintBmp );
clientRect is a CRect and paintBuffer is a CDC object, paintBmp is a CBitmap. They are private members of the window class.
I blit things to paintBuffer as needed and then blit that to the window in the OnPaint event. When the window gets resized how do I update the above variables to handle the new size? Do I need to delete and recreate them? If so how exactly?
My sprites depend on paintBuffer being correct due to saving and restoring the background, I will post more about that if I need to.
Thanks in advance for any help.