From dd4a9de0486520fc47e796f981976ec7529dc465 Mon Sep 17 00:00:00 2001 From: jensgoe Date: Wed, 3 May 2017 16:05:20 +0200 Subject: [PATCH] Fix drawing background in wxDataViewCtrl with rules wxRect to draw the background was prepared in a wrong way if wxDataView had vertical or horizontal rules. Fix this by adjusting the correct component of the rectangle when using horizontal rules and by fixing an off by one bug when using vertical ones. --- src/generic/datavgen.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index d7c02c8f63..e354704229 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -2373,15 +2373,19 @@ void wxDataViewMainWindow::DrawCellBackground( wxDataViewRenderer* cell, wxDC& d // don't overlap the horizontal rules if ( m_owner->HasFlag(wxDV_HORIZ_RULES) ) { - rectBg.x++; - rectBg.width--; + rectBg.y++; + rectBg.height--; } // don't overlap the vertical rules if ( m_owner->HasFlag(wxDV_VERT_RULES) ) { - rectBg.y++; - rectBg.height--; + // same note as in OnPaint handler above + // NB: Vertical rules are drawn in the last pixel of a column so that + // they align perfectly with native MSW wxHeaderCtrl as well as for + // consistency with MSW native list control. There's no vertical + // rule at the most-left side of the control. + rectBg.width--; } cell->RenderBackground(&dc, rectBg);