2009-06-16 Ivan N. Zlatev <contact@i-nz.net>
authorIvan Zlatev <ivan@ivanz.com>
Mon, 15 Jun 2009 23:57:51 +0000 (23:57 -0000)
committerIvan Zlatev <ivan@ivanz.com>
Mon, 15 Jun 2009 23:57:51 +0000 (23:57 -0000)
* DataGridView.cs: Suppress invalidation during data binding.
[Fixes part of bug #512807]

svn path=/trunk/mcs/; revision=136183

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs

index 6c664acf02dda4b017393307b570d8150dc8418c..a2c26d791baffe85d2b348d48f5f6c6103592bde 100644 (file)
@@ -1,3 +1,8 @@
+2009-06-16  Ivan N. Zlatev  <contact@i-nz.net>
+
+       * DataGridView.cs: Suppress invalidation during data binding.
+       [Fixes part of bug #512807]
+
 2009-06-15  Carlos Alberto Cortez <calberto.cortez@gmail.com>
 
        * PrintPreviewDialog.cs: Tune the navigation among the buttons and
index 4695666152e886143472fe5317491558df7d3e16..f5fbe57b62a857548387d609982f38cfbddf5cde 100644 (file)
@@ -2896,7 +2896,8 @@ namespace System.Windows.Forms {
                        if (rowIndex < 0 || rowIndex >= rows.Count)
                                throw new ArgumentOutOfRangeException ("Row index is out of range.");
 
-                       Invalidate (GetCellDisplayRectangle (columnIndex, rowIndex, true));
+                       if (!is_binding)
+                               Invalidate (GetCellDisplayRectangle (columnIndex, rowIndex, true));
                }
 
                public void InvalidateColumn (int columnIndex)
@@ -2904,7 +2905,8 @@ namespace System.Windows.Forms {
                        if (columnIndex < 0 || columnIndex >= columns.Count)
                                throw new ArgumentOutOfRangeException ("Column index is out of range.");
 
-                       Invalidate (GetColumnDisplayRectangle (columnIndex, true));
+                       if (!is_binding)
+                               Invalidate (GetColumnDisplayRectangle (columnIndex, true));
                }
 
                public void InvalidateRow (int rowIndex)
@@ -2912,7 +2914,8 @@ namespace System.Windows.Forms {
                        if (rowIndex < 0 || rowIndex >= rows.Count)
                                throw new ArgumentOutOfRangeException ("Row index is out of range.");
 
-                       Invalidate (GetRowDisplayRectangle (rowIndex, true));
+                       if (!is_binding)
+                               Invalidate (GetRowDisplayRectangle (rowIndex, true));
                }
 
                public virtual void NotifyCurrentCellDirty (bool dirty) {
@@ -6126,8 +6129,6 @@ namespace System.Windows.Forms {
                        }
 
                        PrepareEditingRow (false, true);
-                       PerformLayout();
-                       Invalidate ();
                }
                
                private void MoveCurrentCell (int x, int y, bool select, bool isControl, bool isShift, bool scroll)
@@ -6317,10 +6318,15 @@ namespace System.Windows.Forms {
                private void ReBind ()
                {
                        if (!is_binding) {
+                               SuspendLayout ();
+
                                is_binding = true;
                                ClearBinding ();
                                DoBinding ();
                                is_binding = false;
+
+                               ResumeLayout (true);
+                               Invalidate ();
                        }
                }