diff --git a/docs/changes.txt b/docs/changes.txt index 44bfcce9a6..4536cb44c2 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -603,6 +603,7 @@ wxMSW: - Fix inserting tools removed from wxToolBar back into it (sbrowne). - Fix disabling submenu items in the menus (Artur Wieczorek). - Fix wxEVT_TREE_STATE_IMAGE_CLICK generation (Antal). +- Fix wxDV_ROW_LINES in horizontally scrolled wxDataViewCtrl. wxOSX: diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 57d0a4f4af..24ce1b4802 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -1790,9 +1790,11 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) wxDataViewModel *model = GetModel(); wxAutoBufferedPaintDC dc( this ); + const wxSize size = GetClientSize(); + dc.SetBrush(GetOwner()->GetBackgroundColour()); dc.SetPen( *wxTRANSPARENT_PEN ); - dc.DrawRectangle(GetClientSize()); + dc.DrawRectangle(size); if ( IsEmpty() ) { @@ -1878,13 +1880,16 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(wxBrush(altRowColour)); + // We only need to draw the visible part, so limit the rectangle to it. + const int xRect = m_owner->CalcUnscrolledPosition(wxPoint(0, 0)).x; + const int widthRect = size.x; for (unsigned int item = item_start; item < item_last; item++) { if ( item % 2 ) { - dc.DrawRectangle(x_start, + dc.DrawRectangle(xRect, GetLineStart(item), - GetClientSize().GetWidth(), + widthRect, GetLineHeight(item)); } }