Fixed some off-by-one and other issues with drawing the HRULE/VRULE

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
This commit is contained in:
Robin Dunn
2002-09-11 18:36:55 +00:00
parent d25a60983c
commit e7d073c376
2 changed files with 10 additions and 9 deletions

View File

@@ -2816,7 +2816,8 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
wxPen pen(GetRuleColour(), 1, wxSOLID); wxPen pen(GetRuleColour(), 1, wxSOLID);
wxSize clientSize = GetClientSize(); 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.SetPen(pen);
dc.SetBrush( *wxTRANSPARENT_BRUSH ); dc.SetBrush( *wxTRANSPARENT_BRUSH );
@@ -2825,12 +2826,12 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
} }
// Draw last horizontal rule // Draw last horizontal rule
if ( visibleTo > visibleFrom ) if ( visibleTo == GetItemCount() - 1 )
{ {
dc.SetPen(pen); dc.SetPen(pen);
dc.SetBrush( *wxTRANSPARENT_BRUSH ); dc.SetBrush( *wxTRANSPARENT_BRUSH );
dc.DrawLine(0 - dev_x, m_lineTo*lineHeight, dc.DrawLine(0 - dev_x, (m_lineTo+1)*lineHeight,
clientSize.x - dev_x , m_lineTo*lineHeight ); clientSize.x - dev_x , (m_lineTo+1)*lineHeight );
} }
} }
@@ -2842,8 +2843,8 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
int col = 0; int col = 0;
wxRect firstItemRect; wxRect firstItemRect;
wxRect lastItemRect; wxRect lastItemRect;
GetItemRect(0, firstItemRect); GetItemRect(visibleFrom, firstItemRect);
GetItemRect(GetItemCount() - 1, lastItemRect); GetItemRect(visibleTo, lastItemRect);
int x = firstItemRect.GetX(); int x = firstItemRect.GetX();
dc.SetPen(pen); dc.SetPen(pen);
dc.SetBrush(* wxTRANSPARENT_BRUSH); dc.SetBrush(* wxTRANSPARENT_BRUSH);
@@ -2851,8 +2852,8 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
{ {
int colWidth = GetColumnWidth(col); int colWidth = GetColumnWidth(col);
x += colWidth; x += colWidth;
dc.DrawLine(x - dev_x, firstItemRect.GetY() - 1 - dev_y, dc.DrawLine(x - dev_x - 2, firstItemRect.GetY() - 1 - dev_y,
x - dev_x, lastItemRect.GetBottom() + 1 - dev_y); x - dev_x - 2, lastItemRect.GetBottom() + 1 - dev_y);
} }
} }
} }

View File

@@ -2212,7 +2212,7 @@ void wxListCtrl::OnPaint(wxPaintEvent& event)
{ {
int colWidth = GetColumnWidth(col); int colWidth = GetColumnWidth(col);
x += colWidth ; x += colWidth ;
dc.DrawLine(x, firstItemRect.GetY() - 2, x, itemRect.GetBottom()); dc.DrawLine(x-1, firstItemRect.GetY() - 2, x-1, itemRect.GetBottom());
} }
} }
} }