From df0419d21de163005b156d0dcd6e18d19a6efed6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 11 Sep 2011 21:55:47 +0000 Subject: [PATCH] Fix best size computation for wxTextCtrl without borders in wxMSW. wxTextCtrl with wxBORDER_NONE (and possibly wxTE_READONLY) style is often used instead of a wxStaticText to allow copying the text, so make the size of such control the same as size of the label. This ensures that it aligns correctly with the label vertically while before the baselines were not aligned because a border-less text control was rendered by MSW as a label but had a too big size. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69066 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/textctrl.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 4e2171fbfe..7393cdf0fa 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -2107,9 +2107,17 @@ wxSize wxTextCtrl::DoGetBestSize() const } //else: for single line control everything is ok - // we have to add the adjustments for the control height only once, not - // once per line, so do it after multiplication above - hText += EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) - cy; + // Text controls without border are special and have the same height as + // static labels (they also have the same appearance when they're disable + // and are often used as a sort of copyable to the clipboard label so it's + // important that they have the same height as the normal labels to not + // stand out). + if ( !HasFlag(wxBORDER_NONE) ) + { + // we have to add the adjustments for the control height only once, not + // once per line, so do it after multiplication above + hText += EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) - cy; + } return wxSize(wText, hText); } -- 2.47.2