]> git.saurik.com Git - wxWidgets.git/commitdiff
Align multiline labels correctly in wxMSW owner-drawn buttons.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 16 Oct 2011 17:57:49 +0000 (17:57 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 16 Oct 2011 17:57:49 +0000 (17:57 +0000)
The label wasn't centered correctly in multi-line case.

Closes #13567.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69442 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/anybutton.cpp

index a2382422e73f27d63fc23e6cccc35ed969586de0..0e3da82ea348a59e883144101e312498b0da28bd 100644 (file)
@@ -819,9 +819,9 @@ void DrawButtonText(HDC hdc,
         // now center this rect inside the entire button area
         const LONG w = rc.right - rc.left;
         const LONG h = rc.bottom - rc.top;
         // now center this rect inside the entire button area
         const LONG w = rc.right - rc.left;
         const LONG h = rc.bottom - rc.top;
-        rc.left = (pRect->right - pRect->left)/2 - w/2;
+        rc.left = pRect->left + (pRect->right - pRect->left)/2 - w/2;
         rc.right = rc.left+w;
         rc.right = rc.left+w;
-        rc.top = (pRect->bottom - pRect->top)/2 - h/2;
+        rc.top = pRect->top + (pRect->bottom - pRect->top)/2 - h/2;
         rc.bottom = rc.top+h;
 
         ::DrawText(hdc, text.wx_str(), text.length(), &rc, flags);
         rc.bottom = rc.top+h;
 
         ::DrawText(hdc, text.wx_str(), text.length(), &rc, flags);