From 0487a3d3f175398862bb780523aeee7f24bc645c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 8 Apr 2016 23:11:46 +0200 Subject: [PATCH] Use correct size for the notebook background bitmap in wxMSW Using "r.x + r.width" didn't really make much sense, it just happened to be close enough to the real value to not create any problems when using LTR layout, but was wrong in RTL, resulting in visible vertical line being visible in the notebook client area. Fix this using the same GetThemeBackgroundExtent() for determining the bitmap size as is used for drawing over it. --- src/msw/notebook.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 67e5fa2f7f..1773587820 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -1151,9 +1151,26 @@ WXHBRUSH wxNotebook::QueryBgBitmap() if ( r.IsEmpty() ) return 0; + wxUxThemeHandle theme(this, L"TAB"); + if ( !theme ) + return 0; + + RECT rc; + wxCopyRectToRECT(r, rc); + WindowHDC hDC(GetHwnd()); + wxUxThemeEngine::Get()->GetThemeBackgroundExtent + ( + theme, + (HDC) hDC, + 9 /* TABP_PANE */, + 0, + &rc, + &rc + ); + MemoryHDC hDCMem(hDC); - CompatibleBitmap hBmp(hDC, r.x + r.width, r.y + r.height); + CompatibleBitmap hBmp(hDC, rc.right, rc.bottom); SelectInHDC selectBmp(hDCMem, hBmp);