hi;
i do double buffering technique to draw ellipse as an example, and i can not scroll the page correctly , it seems that the drawing distorted when scrolled the page, the project built upon CScrollview class, so what is wrong, thanks for your time
What I have tried:
i override
void Cfree_flickerView::OnEraseBkgnd(CDC* pDC)
with
return true;
in stead of
return CScrollView::OnEraseBkgnd(pDC);
add these code in
void Cfree_flickerView::OnPaint()
{
CDC memDC;
memDC.CreateCompatibleDC(&dc);
Cfree_flickerView::OnDraw(&dc);<pre>
}
add some codes in
void Cfree_flickerView::OnInitialUpdate()
CSize sizeTotal;
sizeTotal.cx = sizeTotal.cy = 2000;
SetScrollSizes(MM_TEXT, sizeTotal,CSize(200,10),CSize(20,1));
finally add these codes in
void Cfree_flickerView::OnDraw(CDC* pDC)
CRect rcTotal(CPoint(0,0),GetTotalSize());
CDC MemDC;
CBitmap MemBitmap;
pDC = this->GetDC();
MemDC.CreateCompatibleDC(pDC);
MemBitmap.CreateCompatibleBitmap(pDC, rcTotal.right, rcTotal.bottom);
CBitmap *pOldBitmap = (CBitmap*)MemDC.SelectObject(&MemBitmap);
MemDC.Ellipse(rcTotal);
CRect rcClientx;
pDC->BitBlt(0, 0, GetTotalSize().cx, GetTotalSize().cy, &MemDC, 0, 0, SRCCOPY);
MemDC.SelectObject(pOldBitmap);
ReleaseDC(pDC);
ReleaseDC(&MemDC);