diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 4f3ed90f60..156485d6d5 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -1906,7 +1906,8 @@ void wxListCtrl::OnPaint(wxPaintEvent& event) int i; if (drawHRules) { - for (i = 0; i < itemCount; i++) + long top = GetTopItem(); + for (i = top; i < top + GetCountPerPage() + 1; i++) { if (GetItemRect(i, itemRect)) {