Problem is that now my second child window(child2) flickers whenever
it is activated or some other top level window is moved over it.
Although it never causes flicker when I move it
I have used double buffering(off screen dc) and am returning TRUE in
WM_ERASEBKGND message to reduce the flicker in all window drawings.
I have used WS_CLIPCHILDREN WS_CLIPSIBLINGS for the windows(child1 and
child2) which in turn contain more owner drawn child controls.
Here is how my custom control draw looks like
HDC memDC = CreateCompatibleDC(data.hDC);
HBITMAP hMemBmp = CreateCompatibleBitmap(data.hDC, destWidth,
destHeight);
HBITMAP hOldBmp = (HBITMAP)SelectObject(memDC, hMemBmp);
Graphics* pCanvas = Graphics::FromHDC(memDC)
//Drawing is done here on pCanvas
BitBlt(data.hDC, 0, 0, destWidth, destHeight, memDC, 0, 0, SRCCOPY);
//Always select the old bitmap back into the device context
SelectObject(memDC, hOldBmp);
DeleteObject(hMemBmp);
DeleteObject(pCanvas);
DeleteDC(memDC);
Could any please suggest a solution for the same?