Reduce the extra space added to wxMSW wxStaticText to just 1 pixel.
This seems to be still enough to align the static text label and the text control contents when they are positioned next to each other but reduces the amount of "lost" space when they are positioned under each other. Closes #15637. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75129 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -110,24 +110,20 @@ wxSize wxStaticText::DoGetBestClientSize() const
|
|||||||
widthTextMax += 2;
|
widthTextMax += 2;
|
||||||
#endif // __WXWINCE__
|
#endif // __WXWINCE__
|
||||||
|
|
||||||
// It looks like the static control needs "slightly" more vertical space
|
// This extra pixel is a hack we use to ensure that a wxStaticText
|
||||||
// than the character height and while the text isn't actually truncated if
|
// vertically centered around the same position as a wxTextCtrl shows its
|
||||||
// we use just the minimal height, it is positioned differently than when
|
// text on exactly the same baseline. It is not clear why is this needed
|
||||||
// the control has enough space and this result in the text in edit and
|
// nor even whether this works in all cases, but it does work, at least
|
||||||
// static controls not being aligned when the controls themselves are. As
|
// with the default fonts, under Windows XP, 7 and 8, so just use it for
|
||||||
// this is something you really should be able to count on, increase the
|
// now.
|
||||||
// space allocated for the control so that the base lines do align
|
|
||||||
// correctly. Notice that while the above is true at least for the single
|
|
||||||
// line controls, there doesn't seem to do any harm to allocate two extra
|
|
||||||
// pixels in multi-line case neither so do it always for consistency.
|
|
||||||
//
|
//
|
||||||
// I still have no idea why exactly is this needed nor why should we use 2
|
// In the future we really ought to provide a way for each of the controls
|
||||||
// and not something else. This seems to work in all the configurations
|
// to provide information about the position of the baseline for the text
|
||||||
// though (small/large fonts, different OS versions, ...) so just hard code
|
// it shows and use this information in the sizer code when centering the
|
||||||
// it for now. If we need something better later it might be worth looking
|
// controls vertically, otherwise we simply can't ensure that the text is
|
||||||
// at the height of the text control returned by ::GetComboBoxInfo() as it
|
// always on the same line, e.g. even with this hack wxComboBox text is
|
||||||
// seems to be the "minimal acceptable" height.
|
// still not aligned to the same position.
|
||||||
heightTextTotal += 2;
|
heightTextTotal += 1;
|
||||||
|
|
||||||
return wxSize(widthTextMax, heightTextTotal);
|
return wxSize(widthTextMax, heightTextTotal);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user