[MWF] Fix TableLayoutPanel layout bug (#8907)
authorStephen McConnel <stephen_mcconnel@sil.org>
Wed, 12 Dec 2012 18:13:08 +0000 (12:13 -0600)
committerEberhard Beilharz <eb1@sil.org>
Fri, 14 Mar 2014 10:59:22 +0000 (11:59 +0100)
This fixes the TableLayoutPanel implementation to check for control names
as well as the the controls themselves in looking up the row and column
values.

mcs/class/Managed.Windows.Forms/System.Windows.Forms/TableLayoutSettings.cs

index d90990e5d2b9ed8bf7d769745ab05693b0f7d284..1fee1ca35fafd02b97cff6bb0f21bafb114a7d63 100644 (file)
@@ -163,9 +163,15 @@ namespace System.Windows.Forms
                        int row;
 
                        if (!columns.TryGetValue (control, out column))
-                               column = -1;
+                       {
+                               if (!(control is Control) || !columns.TryGetValue ((control as Control).Name, out column))
+                                       column = -1;
+                       }
                        if (!rows.TryGetValue (control, out row))
-                               row = -1;
+                       {
+                               if (!(control is Control) || !rows.TryGetValue ((control as Control).Name, out row))
+                                       row = -1;
+                       }
 
                        return new TableLayoutPanelCellPosition (column, row);
                }
@@ -180,6 +186,8 @@ namespace System.Windows.Forms
 
                        if (columns.TryGetValue (control, out retval))
                                return retval;
+                       if ((control is Control) && columns.TryGetValue ((control as Control).Name, out retval))
+                               return retval;
 
                        return -1;
                }
@@ -193,6 +201,8 @@ namespace System.Windows.Forms
 
                        if (column_spans.TryGetValue (control, out retval))
                                return retval;
+                       if ((control is Control) && column_spans.TryGetValue ((control as Control).Name, out retval))
+                               return retval;
 
                        return 1;
                }
@@ -207,6 +217,8 @@ namespace System.Windows.Forms
 
                        if (rows.TryGetValue (control, out retval))
                                return retval;
+                       if ((control is Control) && rows.TryGetValue ((control as Control).Name, out retval))
+                               return retval;
 
                        return -1;
                }
@@ -220,6 +232,8 @@ namespace System.Windows.Forms
 
                        if (row_spans.TryGetValue (control, out retval))
                                return retval;
+                       if ((control is Control) && row_spans.TryGetValue ((control as Control).Name, out retval))
+                               return retval;
 
                        return 1;
                }