同様の問題がありました。WM_VSCROLL を取得したときに親ウィンドウを更新するには、その領域を無効にする必要がありました。ユーザーdemorgeがここで言うように、私はやろうとしました:
SetBkMode(hdc, TRANSPARENT) が機能しない
しかし、コードはハンドルを使用せず、実際にはクラス CWnd を使用するため、代わりに WindowProc でこれを行うことになりました。
switch(message)
{
...
case WM_VSCROLL:
case WM_HSCROLL:
LRESULT answer;
PAINTSTRUCT ps;
CDC* pdc;
CWnd* MyParentHWnd;
// We want the scroll to work the same way it has always worked for our
// ancestor class. Let them handle the scrolling and save off their
// return.
answer = AncestorClass::WindowProc(message, wParam, lParam);
pdc = BeginPaint(&ps);
// DO NOT change the assignement operator in the conditional below to an
// equality operator. We are actually trying to get the parent window and
// and storing locally, and then verifying that we didn't get back null.
// This is a purposeful design decision.
if (MyParentHWnd = GetParent()){
RECT MyRect;
GetClientRect(&MyRect);
ClientToScreen(&MyRect);
MyParentHWnd->ScreenToClient(&MyRect);
MyParentHWnd->InvalidateRect(&MyRect);
}
EndPaint(&ps);
return answer;
break;
...
}
もちろん、私はそれを少し一般化する必要がありました。はい、あなたの問題を見ている他の人がいて、それを修正する方法を見つけました.