From 81b931f8d175e72e52c58bf9106d61c03a5e6b72 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 4 May 2014 22:13:17 +0000 Subject: [PATCH] Fix the size of owner-drawn checkbox and radiobuttons under Vista and later. The size of the native buttons has changed between XP and Vista, so add version check to draw the buttons of correct size under all Windows versions. See #10137. REBASE: squash with aa5d7c5 Fix the size of owner-drawn check and radio boxes under Vista and later. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/control.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 0ea6a537b7..341bab00bc 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -463,8 +463,16 @@ bool wxControl::MSWOwnerDrawnButton(const DRAWITEMSTRUCT *dis, int flags, bool i rectLabel; rectLabel.top = rect.top + (rect.bottom - rect.top - GetBestSize().y) / 2; rectLabel.bottom = rectLabel.top + GetBestSize().y; - const int MARGIN = 3; - const int CXMENUCHECK = ::GetSystemMetrics(SM_CXMENUCHECK); + + // choose the values consistent with those used for native, non + // owner-drawn, buttons + static const int MARGIN = 3; + int CXMENUCHECK = ::GetSystemMetrics(SM_CXMENUCHECK) + 1; + + // the buttons were even bigger under Windows XP + if ( wxGetWinVersion() < wxWinVersion_6 ) + CXMENUCHECK += 2; + // The space between the button and the label // is included in the button bitmap. const int buttonSize = wxMin(CXMENUCHECK - MARGIN, GetSize().y);