Hi,

I load a 256 colors bitmap and display it, and I want to draw on it some lines, rectangles, circles, etc....
My problem is that when I draw something in the DC directly, the only way to refresh is to display the bitmap and then the draws. And when I move the draws it flicked, and it has an horrible effect !!

How can I manage to do a double buffering ?

I've try to do something like :

CDC * thisDC = GetDC();
CDC * pDC = new CDC;
pDC->CreateCompatibleDC(thisDC);
CBitmap cbm;
cbm.CreateBitmap(m_size.cx,m_size.cy,1,8,NULL);
pDC->SelectObject(&cbm);
DrawBitmap(pDC);

CPen pen(PS_SOLID, 1, RGB(0,255,0));
pDC->SelectObject(&pen);
pDC->MoveTo(CPoint(20,20));
pDC->LineTo(CPoint(100,100));

thisDC->BitBlt(0, 0, m_size.cx, m_size.cy, pDC, 0, 0, SRCCOPY);

..... Delete Objects .....




With this method I never get a green line !! And I don't see my picture.
I have notice that my window is in monochrome and not in color !! If I remove the compatible DC it works.

My question would be : How can I display a bitmap and draw ( and move ) things on it without flicking ?

Where can I find samples which manage double buffering ( in color ) ?


Thanks in advance.

Frédéric Naudeau.