I think the drawing no longer flickers now, so I think it works,
But I also have one toolbar and one status line, which now began to flicker very much.
Is there any way to fix this?
BOOL CPaintDlg::OnEraseBkgnd(CDC* pDC)
{
return true;
}
void CPaintDlg::OnPaint()
{
CRect rcClient;
GetClientRect(rcClient);
CDC MemDC, *pDC;
CBitmap MemBitmap;
pDC = this->GetDC();
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 because im draw on all ClientRect?
Is there a way to exclude part of the toolbars, possibly using ExcludeClipRect?
source
share