I'm using GDI+ in a C++/MFC application and I just can't seem to avoid flickering whenever the window is resized.
I have already tried these steps:
- returned TRUE on
OnEraseBkGnd(); - returned NULL on
OnCtlColor(); - used double buffering according to this code:
void vwView::OnDraw(CDC* pDC)
{
CRect rcClient;
GetClientRect(rcClient);
Bitmap bmp(rcClient.Width(), rcClient.Height());
Graphics graphics(&bmp);
graphics.DrawImage(m_image, rcClient.left, rcClient.top);
Graphics grph(pDC->m_hDC);
grph.DrawImage(&bmp, 0, 0);
}
Am I doing something wrong? Or is there another way to achieve this?