From d9106ec5b679d5c9a5eb61b9633e5f3b1437b6a8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 4 Sep 2013 00:14:37 +0000 Subject: [PATCH] Correct erasing of background behind controls in a toolbar in wxMSW. We need to handle WM_PRINTCLIENT in wxToolBar itself as the default handler for this message forwards to WM_ERASEBKGND of the parent window and our handler for that message only erases the client part of the window, in wx sense, i.e. including a relatively big vertical offset accounting for the toolbar. This means that when we get WM_PRINTCLIENT from the embedded control drawing code, we don't erase anything at all as the control rectangle height is smaller than the offset. This fix is not perfect as ideally the existing MSWGetBgBrushForChild() should be taken into account automatically by the default MSWPrintChild() implementation but at least it fixes the ugly visual artefacts. Closes #12307. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74757 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/toolbar.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/msw/toolbar.cpp b/src/msw/toolbar.cpp index ecaa2b1..c292bb7 100644 --- a/src/msw/toolbar.cpp +++ b/src/msw/toolbar.cpp @@ -1948,6 +1948,10 @@ WXLRESULT wxToolBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam return 0; break; #endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK + + case WM_PRINTCLIENT: + wxFillRect(GetHwnd(), (HDC)wParam, MSWGetToolbarBgBrush()); + return 1; } return wxControl::MSWWindowProc(nMsg, wParam, lParam); -- 2.7.4