estimate size of multiline text controls more accurately (bug 873277)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25647 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-02-08 15:52:37 +00:00
parent ce994095c6
commit f60e797e90

View File

@@ -1963,13 +1963,17 @@ wxSize wxTextCtrl::DoGetBestSize() const
int wText = DEFAULT_ITEM_WIDTH;
int hText = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
int hText = cy;
if ( m_windowStyle & wxTE_MULTILINE )
{
hText *= wxMax(GetNumberOfLines(), 5);
}
//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;
return wxSize(wText, hText);
}