X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7946d7deaac081a745dc616a5eb13ae864865fa2..211cc8dc907ee50ca6d383b8df16bba9a4d3ce2d:/src/msw/listctrl.cpp diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 68cd535490..1196685fe8 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -1904,24 +1904,28 @@ void wxListCtrl::OnPaint(wxPaintEvent& event) int itemCount = GetItemCount(); int i; - for (i = 0; i < itemCount; i++) + if (drawHRules) { - if (GetItemRect(i, itemRect)) + long top = GetTopItem(); + for (i = top; i < top + GetCountPerPage() + 1; i++) { - cy = itemRect.GetTop(); - if (i != 0) // Don't draw the first one - { - dc.DrawLine(0, cy, clientSize.x, cy); - } - // Draw last line - if (i == (GetItemCount() - 1)) + if (GetItemRect(i, itemRect)) { - cy = itemRect.GetBottom(); - dc.DrawLine(0, cy, clientSize.x, cy); + cy = itemRect.GetTop(); + if (i != 0) // Don't draw the first one + { + dc.DrawLine(0, cy, clientSize.x, cy); + } + // Draw last line + if (i == itemCount - 1) + { + cy = itemRect.GetBottom(); + dc.DrawLine(0, cy, clientSize.x, cy); + } } } } - i = (GetItemCount() - 1); + i = itemCount - 1; if (drawVRules && (i > -1)) { wxRect firstItemRect;