I think the drawing now is not flickering anymore so I think it works,
But I have also one toolbar and one statusbar which now started to flicker heavily.
Is there any way to fix this?
BOOL CPaintDlg::OnEraseBkgnd(CDC* pDC) // redraw the background colors
{
return true;
}
void CPaintDlg::OnPaint()
{
CRect rcClient;
GetClientRect(rcClient);
CDC MemDC, *pDC;
CBitmap MemBitmap;
pDC = this->GetDC(); // Get Current DC
MemDC.CreateCompatibleDC(pDC);
MemBitmap.CreateCompatibleBitmap(pDC, rcClient.right, rcClient.bottom);
CBitmap *pOldBitmap = (CBitmap*)MemDC.SelectObject(&MemBitmap);
MemDC.FillSolidRect(0, 0, rcClient.right, rcClient.bottom, RGB(255, 255, 255));
for (int i = 0; i < myShapes.GetSize(); ++i)
myShapes[i]->draw(&MemDC);
pDC->BitBlt(0, 0, rcClient.right, rcClient.bottom, &MemDC, 0, 0, SRCCOPY);
MemDC.SelectObject(pOldBitmap);
ReleaseDC(pDC);
ReleaseDC(&MemDC);
CDialogEx::OnPaint();
}
Edit: Maybe it's because im drawing to the all ClientRect?
Is there a way to exclude the part of the toolbars, maybe with ExcludeClipRect?