]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/listctrl.cpp
better focus handling (blind fix)
[wxWidgets.git] / src / msw / listctrl.cpp
index 68cd5354900cfeef5af520f24562dc3665811c44..1196685fe8506f99ad660b9d43176a5734a05e96 100644 (file)
@@ -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;