Author: jpobst
Date: 2008-02-19 11:10:23 -0500 (Tue, 19 Feb 2008)
New Revision: 96160

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/FlowLayout.cs
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FlowPanelTests.cs
Log:
2008-02-19  Jonathan Pobst  <[EMAIL PROTECTED]>

        * FlowLayout.cs: Take padding into account when determining if there
        is still room left on a row.  [Fixes bug #361448]

2008-02-19  Jonathan Pobst  <[EMAIL PROTECTED]>

        * FlowPanelTests.cs: Add test for bug #361448.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog 
2008-02-19 15:59:12 UTC (rev 96159)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog 
2008-02-19 16:10:23 UTC (rev 96160)
@@ -1,3 +1,8 @@
+2008-02-19  Jonathan Pobst  <[EMAIL PROTECTED]>
+
+       * FlowLayout.cs: Take padding into account when determining if there
+       is still room left on a row.  [Fixes bug #361448]
+
 2008-01-23  Jonathan Pobst  <[EMAIL PROTECTED]>
 
        * TableLayout.cs: Don't include Dock.Fill, multicolumn/multirow spanned

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/FlowLayout.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/FlowLayout.cs 
    2008-02-19 15:59:12 UTC (rev 96159)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/FlowLayout.cs 
    2008-02-19 16:10:23 UTC (rev 96160)
@@ -124,7 +124,7 @@
                                                // Decide if it's time to start 
a new row
                                                // - Our settings must be 
WrapContents, and we ran out of room or the previous control's FlowBreak == true
                                                if (settings.WrapContents  && 
!(parent is ToolStripPanel))
-                                                       if 
((parentDisplayRectangle.Width - currentLocation.X) < (c.Width + c.Margin.Left 
+ c.Margin.Right) || forceFlowBreak) {
+                                                       if 
((parentDisplayRectangle.Width + parentDisplayRectangle.Left - 
currentLocation.X) < (c.Width + c.Margin.Left + c.Margin.Right) || 
forceFlowBreak) {
 
                                                                
currentLocation.Y = FinishRow (rowControls);
                                                                
currentLocation.X = parentDisplayRectangle.Left;
@@ -164,7 +164,7 @@
                                                // Decide if it's time to start 
a new column
                                                // - Our settings must be 
WrapContents, and we ran out of room or the previous control's FlowBreak == true
                                                if (settings.WrapContents)
-                                                       if 
((parentDisplayRectangle.Height - currentLocation.Y) < (c.Height + c.Margin.Top 
+ c.Margin.Bottom) || forceFlowBreak) {
+                                                       if 
((parentDisplayRectangle.Height + parentDisplayRectangle.Top - 
currentLocation.Y) < (c.Height + c.Margin.Top + c.Margin.Bottom) || 
forceFlowBreak) {
 
                                                                
currentLocation.X = FinishColumn (rowControls);
                                                                
currentLocation.Y = parentDisplayRectangle.Top;

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2008-02-19 15:59:12 UTC (rev 96159)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2008-02-19 16:10:23 UTC (rev 96160)
@@ -1,3 +1,7 @@
+2008-02-19  Jonathan Pobst  <[EMAIL PROTECTED]>
+
+       * FlowPanelTests.cs: Add test for bug #361448.
+
 2008-02-19  Jonathan Pobst  <[EMAIL PROTECTED]> 
 
        * ComboBoxTest.cs: Add test for bug #360862.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FlowPanelTests.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FlowPanelTests.cs
   2008-02-19 15:59:12 UTC (rev 96159)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/FlowPanelTests.cs
   2008-02-19 16:10:23 UTC (rev 96160)
@@ -1302,6 +1302,30 @@
                        }
                }
                #endregion
+               
+               [Test]
+               public void Padding ()
+               {
+                       Form f = new Form ();
+                       
+                       FlowLayoutPanel flp = new FlowLayoutPanel ();
+                       flp.Padding = new Padding (20);
+                       flp.Size = new Size (100, 100);
+
+                       Button b = new Button ();
+                       b.Size = new Size (50, 50);
+
+                       Button b2 = new Button ();
+                       b2.Size = new Size (50, 50);
+
+                       flp.Controls.Add (b);
+                       flp.Controls.Add (b2);
+
+                       f.Controls.Add (flp);
+                       
+                       Assert.AreEqual (new Rectangle (23, 23, 50, 50), 
b.Bounds, "A1");
+                       Assert.AreEqual (new Rectangle (23, 79, 50, 50), 
b2.Bounds, "A2");
+               }
        }
 }
 #endif

_______________________________________________
Mono-patches maillist  -  Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to