主要思想就是把本窗口覆盖了的父窗口部分复制到本窗口中。
RECT rc = lpdis->rcItem;
CRect rectClient(rc);
CDCHandle dcClient = lpdis->hDC;
//获得父窗口及其DC
CWindow parent = GetParent();
CClientDC parentDC(parent);
CDCHandle dcMem;
CBitmap bmpBk;
//建立与父窗口兼容的DC和兼容位图
dcMem.CreateCompatibleDC(parentDC);
bmpBk.CreateCompatibleBitmap(parentDC, rectClient.Width(), rectClient.Height());
dcMem.SelectBitmap(bmpBk);
//获得子窗口在父窗口的相对坐标
CRect rect;
GetWindowRect(rect);
parent.ScreenToClient(rect);
//从父窗口屏幕复制到兼容DC
dcMem.BitBlt(0, 0, rectClient.Width(), rectClient.Height(), parentDC, rect.left, rect.top, SRCCOPY);
//do some thing ....
//从兼容DC复制到当前窗口屏幕
dcClient .BitBlt(0, 0, rectClient.Width(), rectClient.Height(), dcMem, 0, 0, SRCCOPY);