control flicker when I use double buffering to avoid window flicker

30 views
Skip to first unread message

Fuquan.Ko

unread,
Apr 28, 2011, 4:19:49 AM4/28/11
to
Now i need to draw some graphics on the entire
dialog ......also ,on the dialog i have some drag Bars(for
example,buttons)
I use double buffer to avoid the dialog flicker ,do something like
this:
1. CRect rect;
this->GetClientRect(rect);
m_memBmp.CreateCompatibleBitmap(pDC,rect.Width(),rect.Height());
CBitmap *pOldBmp=m_memDC.SelectObject(&m_memBmp);
//.........draw graphics into memDC...

pDC->BitBlt(0,0,rect.Width(),rect.Height(),&m_memDC,
0,0,SRCCOPY);

m_memBmp.DeleteObject();
m_memDC.DeleteDC();

2. override the OnEraseBkgnd function ,just to return TRUE;

With the two steps above ,the dialog's flickering can be avoided..
...but when i drag the button to move ,the button flickers....

is there anyway to solve this problem?

thanks for any reply

Reply all
Reply to author
Forward
0 new messages