2007-04-04 Jonathan Pobst <monkey@jpobst.com>
authorJonathan Pobst <monkey@jpobst.com>
Wed, 4 Apr 2007 14:53:06 +0000 (14:53 -0000)
committerJonathan Pobst <monkey@jpobst.com>
Wed, 4 Apr 2007 14:53:06 +0000 (14:53 -0000)
* FlowLayout.cs: Call SetBounds with BoundsSpecified.None instead of
using Control Size, Location setters.

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

mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/FlowLayout.cs

index 3d3e4a9d03d03ed362369e9c259bc3467ce2f7f0..dc8f4902cb8ea5dcd4b1d104b1955dc4e00c9452 100644 (file)
@@ -1,3 +1,8 @@
+2007-04-04  Jonathan Pobst  <monkey@jpobst.com>
+
+       * FlowLayout.cs: Call SetBounds with BoundsSpecified.None instead of
+       using Control Size, Location setters.
+
 2007-03-24  Jonathan Pobst  <monkey@jpobst.com>
 
        * DefaultLayout.cs: Call SetBounds with BoundsSpecified.None instead
index 95bfa6bd619cba3cc4cdc416fb0566761a2e962c..d5a187921e59bb410878a2484c26e2b953c8e5a5 100644 (file)
@@ -93,8 +93,10 @@ namespace System.Windows.Forms.Layout
                                if (!c.Visible) { continue; }
 
                                // Resize any AutoSize controls to their preferred size
-                               if (c.AutoSize == true)
-                                       c.Size = c.GetPreferredSize (c.Size);
+                               if (c.AutoSize == true) {
+                                       Size new_size = c.GetPreferredSize (c.Size);
+                                       c.SetBounds (c.Left, c.Top, new_size.Width, new_size.Height, BoundsSpecified.None);
+                               }
 
                                switch (settings.FlowDirection) {
                                        case FlowDirection.BottomUp:
@@ -112,7 +114,7 @@ namespace System.Windows.Forms.Layout
 
                                                // Offset the right margin and set the control to our point
                                                currentLocation.Offset (0, c.Margin.Bottom * -1);
-                                               c.Location = new Point (currentLocation.X + c.Margin.Left, currentLocation.Y - c.Height);
+                                               c.SetBounds (currentLocation.X + c.Margin.Left, currentLocation.Y - c.Height, c.Width, c.Height, BoundsSpecified.None);
 
                                                // Update our location pointer
                                                currentLocation.Y -= (c.Height + c.Margin.Top);
@@ -133,7 +135,7 @@ namespace System.Windows.Forms.Layout
 
                                                // Offset the left margin and set the control to our point
                                                currentLocation.Offset (c.Margin.Left, 0);
-                                               c.Location = new Point (currentLocation.X, currentLocation.Y + c.Margin.Top);
+                                               c.SetBounds (currentLocation.X, currentLocation.Y + c.Margin.Top, c.Width, c.Height, BoundsSpecified.None);
 
                                                // Update our location pointer
                                                currentLocation.X += c.Width + c.Margin.Right;
@@ -153,7 +155,7 @@ namespace System.Windows.Forms.Layout
 
                                                // Offset the right margin and set the control to our point
                                                currentLocation.Offset (c.Margin.Right * -1, 0);
-                                               c.Location = new Point (currentLocation.X - c.Width, currentLocation.Y + c.Margin.Top);
+                                               c.SetBounds (currentLocation.X - c.Width, currentLocation.Y + c.Margin.Top, c.Width, c.Height, BoundsSpecified.None);
 
                                                // Update our location pointer
                                                currentLocation.X -= (c.Width + c.Margin.Left);
@@ -173,7 +175,7 @@ namespace System.Windows.Forms.Layout
 
                                                // Offset the top margin and set the control to our point
                                                currentLocation.Offset (0, c.Margin.Top);
-                                               c.Location = new Point (currentLocation.X + c.Margin.Left, currentLocation.Y);
+                                               c.SetBounds (currentLocation.X + c.Margin.Left, currentLocation.Y, c.Width, c.Height, BoundsSpecified.None);
 
                                                // Update our location pointer
                                                currentLocation.Y += c.Height + c.Margin.Bottom;
@@ -238,15 +240,15 @@ namespace System.Windows.Forms.Layout
                        // Set the new heights for each control
                        foreach (Control c in row)
                                if (allDockFill && noAuto)
-                                       c.Height = 0;
+                                       c.SetBounds (c.Left, c.Top, c.Width, 0, BoundsSpecified.None);
                                else if (c.Dock == DockStyle.Fill || ((c.Anchor & AnchorStyles.Top) == AnchorStyles.Top) && ((c.Anchor & AnchorStyles.Bottom) == AnchorStyles.Bottom))
-                                       c.Height = rowBottom - c.Top - c.Margin.Bottom;
+                                       c.SetBounds (c.Left, c.Top, c.Width, rowBottom - c.Top - c.Margin.Bottom, BoundsSpecified.None);
                                else if (c.Dock == DockStyle.Bottom || ((c.Anchor & AnchorStyles.Bottom) == AnchorStyles.Bottom))
-                                       c.Top = rowBottom - c.Margin.Bottom - c.Height;
+                                       c.SetBounds (c.Left, rowBottom - c.Margin.Bottom - c.Height, c.Width, c.Height, BoundsSpecified.None);
                                else if (c.Dock == DockStyle.Top || ((c.Anchor & AnchorStyles.Top) == AnchorStyles.Top))
                                        continue;
                                else
-                                       c.Top = ((rowBottom - rowTop) / 2) - (c.Height / 2) + (int)Math.Floor (((c.Margin.Top - c.Margin.Bottom) / 2.0)) + rowTop;
+                                       c.SetBounds (c.Left, ((rowBottom - rowTop) / 2) - (c.Height / 2) + (int)Math.Floor (((c.Margin.Top - c.Margin.Bottom) / 2.0)) + rowTop, c.Width, c.Height, BoundsSpecified.None);
 
                        // Return bottom y of this row used
                        if (rowBottom == 0)
@@ -297,15 +299,15 @@ namespace System.Windows.Forms.Layout
                        // Set the new widths for each control
                        foreach (Control c in col)
                                if (allDockFill && noAuto)
-                                       c.Width = 0;
+                                       c.SetBounds (c.Left, c.Top, 0, c.Height, BoundsSpecified.None);
                                else if (c.Dock == DockStyle.Fill || ((c.Anchor & AnchorStyles.Left) == AnchorStyles.Left) && ((c.Anchor & AnchorStyles.Right) == AnchorStyles.Right))
-                                       c.Width = rowRight - c.Left - c.Margin.Right;
+                                       c.SetBounds (c.Left, c.Top, rowRight - c.Left - c.Margin.Right, c.Height, BoundsSpecified.None);
                                else if (c.Dock == DockStyle.Right || ((c.Anchor & AnchorStyles.Right) == AnchorStyles.Right))
-                                       c.Left = rowRight - c.Margin.Right - c.Width;
+                                       c.SetBounds (rowRight - c.Margin.Right - c.Width, c.Top, c.Width, c.Height, BoundsSpecified.None);
                                else if (c.Dock == DockStyle.Left || ((c.Anchor & AnchorStyles.Left) == AnchorStyles.Left))
                                        continue;
                                else
-                                       c.Left = ((rowRight - rowLeft) / 2) - (c.Width / 2) + (int)Math.Floor (((c.Margin.Left - c.Margin.Right) / 2.0)) + rowLeft;
+                                       c.SetBounds (((rowRight - rowLeft) / 2) - (c.Width / 2) + (int)Math.Floor (((c.Margin.Left - c.Margin.Right) / 2.0)) + rowLeft, c.Top, c.Width, c.Height, BoundsSpecified.None);
 
                        // Return rightmost x of this row used
                        if (rowRight == 0)
@@ -460,7 +462,7 @@ namespace System.Windows.Forms.Layout
                                FinishColumn (rowControls);
 
                        if (final_height > 0)
-                               parent.Height = final_height + parent.Padding.Bottom;
+                               parent.SetBounds (parent.Left, parent.Top, parent.Width, final_height + parent.Padding.Bottom, BoundsSpecified.None);
                                
                        return false;