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
This commit is contained in:
Vadim Zeitlin 2014-05-04 22:13:17 +00:00
parent fd65d4b4f5
commit 81b931f8d1

View File

@ -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);