Author: jpobst
Date: 2007-09-11 11:48:29 -0400 (Tue, 11 Sep 2007)
New Revision: 85642

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/DefaultLayout.cs
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DefaultLayoutTest.cs
Log:
2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>

        * DefaultLayout.cs: When working with Anchor = none, and we move a
        control, we need to update its dist_right/dist_bottom.
        [Fixes bug #82762]

2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>

        * DefaultLayoutTest.cs: Add test for bug #82762.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog 
2007-09-11 15:21:17 UTC (rev 85641)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog 
2007-09-11 15:48:29 UTC (rev 85642)
@@ -1,3 +1,9 @@
+2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>
+
+       * DefaultLayout.cs: When working with Anchor = none, and we move a
+       control, we need to update its dist_right/dist_bottom.
+       [Fixes bug #82762]
+
 2007-09-06  Jonathan Pobst  <[EMAIL PROTECTED]>
 
        * DefaultLayout.cs: Only LayoutAutoSizeContainer if the container is

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/DefaultLayout.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/DefaultLayout.cs
  2007-09-11 15:21:17 UTC (rev 85641)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/DefaultLayout.cs
  2007-09-11 15:48:29 UTC (rev 85642)
@@ -132,6 +132,7 @@
                                        // left+=diff_width/2 will introduce 
rounding errors (diff_width removed from svn after r51780)
                                        // This calculates from scratch every 
time:
                                        left = left + (space.Width - (left + 
width + child.dist_right)) / 2;
+                                       child.dist_right = space.Width - (left 
+ height);
                                }
 
                                if ((anchor & AnchorStyles.Bottom) != 0) {
@@ -144,6 +145,7 @@
                                        // top += diff_height/2 will introduce 
rounding errors (diff_height removed from after r51780)
                                        // This calculates from scratch every 
time:
                                        top = top + (space.Height - (top + 
height + child.dist_bottom)) / 2;
+                                       child.dist_bottom = space.Height - (top 
+ height);
                                }
 
                                // Sanity

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-09-11 15:21:17 UTC (rev 85641)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-09-11 15:48:29 UTC (rev 85642)
@@ -1,3 +1,7 @@
+2007-09-11  Jonathan Pobst  <[EMAIL PROTECTED]>
+
+       * DefaultLayoutTest.cs: Add test for bug #82762.
+
 2007-09-06  Jonathan Pobst  <[EMAIL PROTECTED]>
 
        * TableLayoutTest.cs: Make test for bug #82605 not depend on font 
measurements.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DefaultLayoutTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DefaultLayoutTest.cs
        2007-09-11 15:21:17 UTC (rev 85641)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DefaultLayoutTest.cs
        2007-09-11 15:48:29 UTC (rev 85642)
@@ -524,6 +524,29 @@
                }
 #endif
 
+               [Test]
+               public void Bug82762 ()
+               {
+                       Form f = new Form ();
+                       f.ShowInTaskbar = false;
+                       
+                       Button b = new Button ();
+                       b.Size = new Size (100, 100);
+                       b.Anchor = AnchorStyles.None;
+                       f.Controls.Add (b);
+                       
+                       f.Show ();
+                       
+                       Assert.AreEqual (new Rectangle (0, 0, 100, 100), 
b.Bounds, "A1");
+                       
+                       f.ClientSize = new Size (600, 600);
+
+                       Assert.AreEqual (new Rectangle (158, 168, 100, 100), 
b.Bounds, "A2");
+
+                       f.Close ();
+                       f.Dispose ();
+               }
+               
                [Test]  // bug #81199
                public void NestedControls ()
                {

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

Reply via email to