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,
HBITMAP hOldBmp = (HBITMAP)SelectObject(memDC1, hMemBmp);
memDC->DrawText(line.word.str, -1, &rText, DT_LEFT);
BitBlt(lpDrawItemStruct->hDC, 0, 0, scrW, scrH, memDC1, 0, 0,
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.