Remove FromDIP in wxGetEditHeightFromCharHeight
This caused wxTextCtrl to become to high at higher DPI. It was added to fix appearance of wxSearchCtrl at high DPI. Remove an unneeded FromDIP there too, so it gets the same height as a normal wxTextCtrl. And centre the textctrl inside the searchctrl.
This commit is contained in:
@@ -91,12 +91,13 @@ WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
||||
// Return the height of a native text control corresponding to the given
|
||||
// character height (as returned by GetCharHeight() or wxGetCharSize()).
|
||||
//
|
||||
// The wxWindow parameter must be valid and used for getting the DPI.
|
||||
inline int wxGetEditHeightFromCharHeight(int cy, const wxWindow* w)
|
||||
// The wxWindow parameter is currently not used but should still be valid.
|
||||
inline int wxGetEditHeightFromCharHeight(int cy, const wxWindow* WXUNUSED(w))
|
||||
{
|
||||
// The value 8 here is empiric, i.e. it's not necessarily correct, but
|
||||
// seems to work relatively well.
|
||||
return cy + w->FromDIP(8);
|
||||
// Don't use FromDIP(8), this seems not needed.
|
||||
return cy + 8;
|
||||
}
|
||||
|
||||
// Compatibility macro used in the existing code. It assumes that it's called
|
||||
|
@@ -132,7 +132,8 @@ protected:
|
||||
// can't use wxBORDER_NONE to calculate a good height, in which case we just have to
|
||||
// assume a border in the code above and then subtract the space that would be taken up
|
||||
// by a themed border (the thin blue border and the white internal border).
|
||||
size.y -= FromDIP(4);
|
||||
// Don't use FromDIP(4), this seems not needed.
|
||||
size.y -= 4;
|
||||
|
||||
self->SetWindowStyleFlag(flags);
|
||||
|
||||
@@ -533,7 +534,7 @@ void wxSearchCtrl::LayoutControls()
|
||||
// of the white border that's part of the theme border. We can also remove a pixel from
|
||||
// the height to fit the text control in, because the padding in EDIT_HEIGHT_FROM_CHAR_HEIGHT
|
||||
// is already generous.
|
||||
int textY = FromDIP(2);
|
||||
int textY = FromDIP(1);
|
||||
#else
|
||||
int textY = 0;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user