Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

double buffering

aangermaaangerma Member Posts: 14
Hello,
I have an owner-draw listBox that while updating its flicks, I tried the solution of treating the event OnEraseBkgnd its didn't work, so I tried the other posibility - double buffering

void CIconListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
HDC memDC1 = CreateCompatibleDC(lpDrawItemStruct->hDC);
HBITMAP hMemBmp = CreateCompatibleBitmap(lpDrawItemStruct->hDC,
scrW, scrH);
HBITMAP hOldBmp = (HBITMAP)SelectObject(memDC1, hMemBmp);
CDC *memDC=CDC::FromHandle(memDC1);
.
.
if(m_pImgClose)
m_pImgClose->Draw(memDC,0,pt1,ILD_NORMAL);
.
.
memDC->DrawText(line.word[1].str, -1, &rText, DT_LEFT);
.
.
SetTextColor(memDC1,oldcolor);
.
.
BitBlt(lpDrawItemStruct->hDC, 0, 0, scrW, scrH, memDC1, 0, 0,
SRCCOPY);
SelectObject(memDC1, hOldBmp);
DeleteObject(hMemBmp);
DeleteDC(memDC1);
}
for some resone its doing the background black instead of white as it was before the double buffer.
if anyone know what is my problem ,I would be very greatfull for him.

Comments

Sign In or Register to comment.