From 093a955fcc0ad9b2ed30172db54d11daae98aa9d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 23 Jun 2016 22:16:26 +0200 Subject: [PATCH] Don't make wxBU_EXACTFIT buttons too tall in wxMSW Fix regression introduced by bd388e9827c004a55bc971a32350523320ae7919: bitmap buttons could now be made significantly taller than the text control height if their bitmap was big enough. Only make buttons taller if they wouldn't be tall enough on their own, instead of always increasing their height, even if it's already big enough. Closes #17576. --- src/msw/anybutton.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/msw/anybutton.cpp b/src/msw/anybutton.cpp index 034dbce424..3a2214e85a 100644 --- a/src/msw/anybutton.cpp +++ b/src/msw/anybutton.cpp @@ -459,7 +459,11 @@ wxSize wxMSWButton::IncreaseToStdSizeAndCache(wxControl *btn, const wxSize& size { // Such buttons are typically used alongside a text control or similar, // so make them as high as it. - sizeBtn.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(size.y); + int yText; + wxGetCharSize(GetHwndOf(btn), NULL, &yText, btn->GetFont()); + yText = EDIT_HEIGHT_FROM_CHAR_HEIGHT(yText); + + sizeBtn.IncTo(wxSize(-1, yText)); } btn->CacheBestSize(sizeBtn);