From a358c898c55bcda640cfc21da2fa7fbca663914c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 25 Jan 2016 02:51:06 +0100 Subject: [PATCH] Don't account for the border size twice in wxMSW wxListCtrl When computing the best control width from height, or vice versa, don't account for the border size twice, once inside ListView_ApproximateViewRect() and another time in our own code in the base class. As we can't change the former, just compensate what the latter does by returning the best width or height of the client part of the control, as indicated by the DoGetBestClient{Height,Width}() methods names. --- src/msw/listctrl.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 2019554161..08e459d9b1 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -1350,7 +1350,10 @@ wxSize wxListCtrl::MSWGetBestViewRect(int x, int y) const if ( mswStyle & WS_VSCROLL ) size.x += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); - return size; + // OTOH we have to subtract the size of our borders because the base class + // public method already adds them, but ListView_ApproximateViewRect() + // already takes the borders into account, so this would be superfluous. + return size - DoGetBorderSize(); } // ----------------------------------------------------------------------------