Odd resizing behavior in MFC
I have a dialog with a generic CWnd embedded into it.
I want to allow the user to change the size of the dialog. So here is my method:
This is the OnSize handler in the dialog window
So you see I'm passing the command then to the CWnd and using MoveWindow to change the size of that window.
void TilePickerDlg::OnSize(UINT nType, int cx, int cy)
CDialog::OnSize(nType, cx, cy);
My renderer then needs to re-calculate the size of the memory bitmap for the window since I'm using double buffering.
Here is the Resize code:
It is inline which is why the class name is not in front of the function name. So it's a simple, de-select the existing bitmap - which is the MemoryBitmap, detach it, re-create it, and then re-select it into the DC. Then re-calc the scroll extents.
void Resize(int cx,int cy)
//Select bitmap into DC
It works great until the window gets past a certain size and then it acts as if the DC is corrupt. It still draws, but it slows everything down in the editor. All drawing begins to look like slideshows.