I have a
dialog box with a
bitmap as background.
I am trying to create transparent
treeview so I need to grab the underlying bitmap from
treeview's WM_PAINT
handler, but I do not know how to do this.
I assume that I will need
ScreenToClient
and
ClientToScreen
APIs, but I do not know how to use them.
In my
WM_PAINT
handler, I have this:
memBmp = CreateCompatibleBitmap( hdc, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top );
bmpOldFinal = (HBITMAP)SelectObject( memDC, memBmp );
HDC pDC = GetDC( GetParent(hwnd) );
POINT ptTreeUL, ptTreeLR;
ptTreeUL.x = rcClient.left;
ptTreeUL.y = rcClient.top;
ptTreeLR.x = rcClient.right + 1;
ptTreeLR.y = rcClient.bottom + 1;
ClientToScreen( hwnd, &ptTreeUL );
ClientToScreen( hwnd, &ptTreeLR );
BitBlt( memDC, 0, 0,
rcClient.right - rcClient.left,
rcClient.bottom - rcClient.top,
pDC,
ptTreeLR.x - ptTreeUL.x,
ptTreeLR.y - ptTreeUL.y, SRCCOPY );
ReleaseDC( GetParent(hwnd), pDC );
Unfortunately, the coordinates I get are not good, and although I get a part of the bitmap Blited into memory DC it is not the correct part.
How can I blit the underlying portion of the parent background into treeview's memory DC ?
Thank you.
Best regards.