Browse Source

Rewrite next_pixel_offset calculation in a way that makes more sense. Should not have any effect.

Thomas Goldstein 13 years ago
parent
commit
978ee48fce
1 changed files with 6 additions and 2 deletions
  1. 6 2
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs

+ 6 - 2
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs

@@ -2654,8 +2654,12 @@ namespace System.Windows.Forms
 			XplatUI.ScrollWindow (Handle, area, pixels, 0, false);
 
 			int pixel_offset = GetColumnStartingPixel (CurrentColumn);
-			int next_pixel_offset = CurrentColumn >= CurrentTableStyle.GridColumnStyles.Count ?
-				0 : pixel_offset + CurrentTableStyle.GridColumnStyles[CurrentColumn].Width;
+			int next_pixel_offset = pixel_offset;
+
+			if (CurrentColumn < CurrentTableStyle.GridColumnStyles.Count)
+			{
+				next_pixel_offset += CurrentTableStyle.GridColumnStyles[CurrentColumn].Width;
+			}
 
 			if (pixel_offset >= horiz_pixeloffset
 			    && next_pixel_offset < horiz_pixeloffset + cells_area.Width)