]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed some off-by-one and other issues with drawing the HRULE/VRULE
authorRobin Dunn <robin@alldunn.com>
Wed, 11 Sep 2002 18:36:55 +0000 (18:36 +0000)
committerRobin Dunn <robin@alldunn.com>
Wed, 11 Sep 2002 18:36:55 +0000 (18:36 +0000)
lines.  Made the VRULEs line up with the column header splitter
lines.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17136 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/listctrl.cpp
src/msw/listctrl.cpp

index b85060db7fc539ba0e3e836b530cf789f7c524a5..911612205e2ebe91ebf16c97c245556b3b65fc3c 100644 (file)
@@ -2816,7 +2816,8 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
             wxPen pen(GetRuleColour(), 1, wxSOLID);
             wxSize clientSize = GetClientSize();
 
-            for ( size_t i = visibleFrom; i <= visibleTo; i++ )
+            // Don't draw the first one
+            for ( size_t i = visibleFrom+1; i <= visibleTo; i++ )
             {
                 dc.SetPen(pen);
                 dc.SetBrush( *wxTRANSPARENT_BRUSH );
@@ -2825,12 +2826,12 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
             }
 
             // Draw last horizontal rule
-            if ( visibleTo > visibleFrom )
+            if ( visibleTo == GetItemCount() - 1 )
             {
                 dc.SetPen(pen);
                 dc.SetBrush( *wxTRANSPARENT_BRUSH );
-                dc.DrawLine(0 - dev_x, m_lineTo*lineHeight,
-                            clientSize.x - dev_x , m_lineTo*lineHeight );
+                dc.DrawLine(0 - dev_x, (m_lineTo+1)*lineHeight,
+                            clientSize.x - dev_x , (m_lineTo+1)*lineHeight );
             }
         }
 
@@ -2842,8 +2843,8 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
             int col = 0;
             wxRect firstItemRect;
             wxRect lastItemRect;
-            GetItemRect(0, firstItemRect);
-            GetItemRect(GetItemCount() - 1, lastItemRect);
+            GetItemRect(visibleFrom, firstItemRect);
+            GetItemRect(visibleTo, lastItemRect);
             int x = firstItemRect.GetX();
             dc.SetPen(pen);
             dc.SetBrush(* wxTRANSPARENT_BRUSH);
@@ -2851,8 +2852,8 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
             {
                 int colWidth = GetColumnWidth(col);
                 x += colWidth;
-                dc.DrawLine(x - dev_x, firstItemRect.GetY() - 1 - dev_y,
-                            x - dev_x, lastItemRect.GetBottom() + 1 - dev_y);
+                dc.DrawLine(x - dev_x - 2, firstItemRect.GetY() - 1 - dev_y,
+                            x - dev_x - 2, lastItemRect.GetBottom() + 1 - dev_y);
             }
         }
     }
index b57021fd00b2d8e58b1a5b1913fe1310d0b4510c..524a9413f4161077728603cdf2ae21141e2d7864 100644 (file)
@@ -2212,7 +2212,7 @@ void wxListCtrl::OnPaint(wxPaintEvent& event)
             {
                 int colWidth = GetColumnWidth(col);
                 x += colWidth ;
-                dc.DrawLine(x, firstItemRect.GetY() - 2, x, itemRect.GetBottom());
+                dc.DrawLine(x-1, firstItemRect.GetY() - 2, x-1, itemRect.GetBottom());
             }
         }
     }