Author: jpobst
Date: 2008-01-23 11:26:00 -0500 (Wed, 23 Jan 2008)
New Revision: 93668

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/TableLayout.cs
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TableLayoutTest.cs
Log:
2008-01-23  Jonathan Pobst  <[EMAIL PROTECTED]>

        * TableLayout.cs: Don't include Dock.Fill, multicolumn/multirow spanned
        controls when calculating column/row sizes.
        [Fixes bug #355408]

2008-01-23  Jonathan Pobst  <[EMAIL PROTECTED]>

        * TableLayoutTest.cs: Add test for bug #355408.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog 
2008-01-23 16:10:29 UTC (rev 93667)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog 
2008-01-23 16:26:00 UTC (rev 93668)
@@ -1,3 +1,9 @@
+2008-01-23  Jonathan Pobst  <[EMAIL PROTECTED]>
+
+       * TableLayout.cs: Don't include Dock.Fill, multicolumn/multirow spanned
+       controls when calculating column/row sizes.
+       [Fixes bug #355408]
+
 2008-01-22  Jonathan Pobst  <[EMAIL PROTECTED]>
 
        * DefaultLayout.cs: Remove using the padding.  This is now included

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/TableLayout.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/TableLayout.cs
    2008-01-23 16:10:29 UTC (rev 93667)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/TableLayout.cs
    2008-01-23 16:26:00 UTC (rev 93668)
@@ -260,9 +260,12 @@
                                        for (int i = 0; i < rows; i ++)
                                        {
                                                Control c = 
panel.actual_positions[index, i];
-                                               
+
                                                if (c != null && c != 
dummy_control && c.VisibleInternal)
                                                {
+                                                       if 
(settings.GetColumnSpan (c) > 1)
+                                                               continue;
+                                                               
                                                        if (c.Dock == 
DockStyle.Fill || ((c.Anchor & AnchorStyles.Left) == AnchorStyles.Left && 
(c.Anchor & AnchorStyles.Right) == AnchorStyles.Right)) {
                                                                if (c.AutoSize)
                                                                        
max_width = Math.Max (max_width, c.PreferredSize.Width + c.Margin.Horizontal);
@@ -271,8 +274,6 @@
                                                                
                                                                continue;
                                                        }
-                                                       else if 
(settings.GetColumnSpan (c) > 1)
-                                                               continue;
                                                        
                                                        if (c.Width + 
c.Margin.Left + c.Margin.Right > max_width)
                                                                max_width = 
c.Width + c.Margin.Left + c.Margin.Right;                                       
    
@@ -343,6 +344,9 @@
                                                Control c = 
panel.actual_positions[i, index];
 
                                                if (c != null && c != 
dummy_control && c.VisibleInternal) {
+                                                       if (settings.GetRowSpan 
(c) > 1)
+                                                               continue; 
+                                                               
                                                        if (c.Dock == 
DockStyle.Fill || ((c.Anchor & AnchorStyles.Top) == AnchorStyles.Top && 
(c.Anchor & AnchorStyles.Bottom) == AnchorStyles.Bottom)) {
                                                                if (c.AutoSize)
                                                                        
max_height = Math.Max (max_height, c.PreferredSize.Height + c.Margin.Vertical);
@@ -351,8 +355,6 @@
 
                                                                continue;
                                                        }
-                                                       else if 
(settings.GetRowSpan (c) > 1)
-                                                               continue;
 
                                                        if (c.Height + 
c.Margin.Top + c.Margin.Bottom > max_height)
                                                                max_height = 
c.Height + c.Margin.Top + c.Margin.Bottom;

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2008-01-23 16:10:29 UTC (rev 93667)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2008-01-23 16:26:00 UTC (rev 93668)
@@ -1,3 +1,7 @@
+2008-01-23  Jonathan Pobst  <[EMAIL PROTECTED]>
+
+       * TableLayoutTest.cs: Add test for bug #355408.
+
 2008-01-22  Jonathan Pobst  <[EMAIL PROTECTED]>
 
        * TableLayoutTest.cs: Add test for bug #354676.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TableLayoutTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TableLayoutTest.cs
  2008-01-23 16:10:29 UTC (rev 93667)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TableLayoutTest.cs
  2008-01-23 16:26:00 UTC (rev 93668)
@@ -1290,6 +1290,39 @@
                        f.Close ();
                        f.Dispose ();
                }
+               
+               [Test]
+               public void Bug355408 ()
+               {
+                       Form f = new Form ();
+
+                       TableLayoutPanel tlp = new TableLayoutPanel ();
+                       tlp.Dock = DockStyle.Fill;
+                       tlp.RowCount = 2;
+                       tlp.ColumnCount = 2;
+                       f.Controls.Add (tlp);
+
+                       Button b1 = new Button ();
+                       tlp.Controls.Add (b1);
+
+                       Button b2 = new Button ();
+                       tlp.Controls.Add (b2);
+                       
+                       Button b3 = new Button ();
+                       b3.Dock = DockStyle.Fill;
+                       b3.Width = 250;
+                       tlp.SetColumnSpan (b3, 2);
+                       tlp.Controls.Add (b3);
+
+                       f.Show ();
+
+                       Assert.AreEqual (new Rectangle (3, 3, 75, 23), 
b1.Bounds, "A1");
+                       Assert.AreEqual (new Rectangle (84, 3, 75, 23), 
b2.Bounds, "A2");
+                       Assert.AreEqual (new Rectangle (3, 32, 278, 229), 
b3.Bounds, "A3");
+
+                       f.Close ();
+                       f.Dispose ();
+               }
        }
 }
 #endif

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to