From 6397b59b65195dd0822598ce6c87c902720ee3bc Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 2 Oct 2002 13:38:50 +0000 Subject: [PATCH] Applied patch [ 609516 ] AutoSize does not remove scrollbars git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17432 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 1ecb7e28b0..e40914e12f 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -9285,12 +9285,15 @@ void wxGrid::AutoSize() // round up the size to a multiple of scroll step - this ensures that we // won't get the scrollbars if we're sized exactly to this width - wxSize sizeFit(GetScrollX(size.x) * GRID_SCROLL_LINE_X, - GetScrollY(size.y) * GRID_SCROLL_LINE_Y); + // CalcDimension adds m_extraWidth + 1 etc. to calculate the necessary + // scrollbar steps + wxSize sizeFit(GetScrollX(size.x + m_extraWidth + 1) * GRID_SCROLL_LINE_X, + GetScrollY(size.y + m_extraHeight + 1) * GRID_SCROLL_LINE_Y); // distribute the extra space between teh columns/rows to avoid having // extra white space - wxCoord diff = sizeFit.x - size.x; + // Remove the extra m_extraWidth + 1 added above + wxCoord diff = sizeFit.x - size.x + (m_extraWidth + 1); if ( diff ) { // try to resize the columns uniformly @@ -9315,7 +9318,7 @@ void wxGrid::AutoSize() } // same for rows - diff = sizeFit.y - size.y; + diff = sizeFit.y - size.y - (m_extraHeight + 1); if ( diff ) { // try to resize the columns uniformly