2007-05-23 Jonathan Pobst <monkey@jpobst.com>
authorJonathan Pobst <monkey@jpobst.com>
Wed, 23 May 2007 20:27:13 +0000 (20:27 -0000)
committerJonathan Pobst <monkey@jpobst.com>
Wed, 23 May 2007 20:27:13 +0000 (20:27 -0000)
* Control.cs: Apply patch from George to call parent.PerformLayout
when Visible is changed.  [Fixes bugs #81118, 81718]

2007-05-23  Jonathan Pobst  <monkey@jpobst.com>

* ControlTest.cs: Add test to show that setting a control's Visible
property causes it's parent to relayout.

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

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlTest.cs

index e874e5fadcc259a914abe0939b81f009128415be..d979c9981f37b23939bf054ea66c1355a87bccb8 100644 (file)
@@ -1,3 +1,8 @@
+2007-05-23  Jonathan Pobst  <monkey@jpobst.com>
+
+       * Control.cs: Apply patch from George to call parent.PerformLayout
+       when Visible is changed.  [Fixes bugs #81118, 81718]
+
 2007-05-23  Everaldo Canuto  <ecanuto@novell.com>
 
        * MainMenu.cs, MenuAPI.cs: Implement Collapse event for MainMenu (2.0).
index fae9501e1c97a4ae1b018933964c937142842b2d..2b5cfea04941232a1479e72864c52442ae008713 100644 (file)
@@ -3177,7 +3177,12 @@ namespace System.Windows.Forms
                        }
 
                        set {
-                               SetVisibleCore(value);
+                               if (this.is_visible != value) {
+                                       SetVisibleCore(value);
+
+                                       if (parent != null)
+                                               parent.PerformLayout (this, "Visible");
+                               }
                        }
                }
 
index 88e4f33b841f25b2f1bfa54b00be7c825d37b25d..5ad5af769c2b0f3af9cee17b0b8dfa77536a18e7 100644 (file)
@@ -1,3 +1,8 @@
+2007-05-23  Jonathan Pobst  <monkey@jpobst.com>
+
+       * ControlTest.cs: Add test to show that setting a control's Visible
+       property causes it's parent to relayout.
+
 2007-05-23  Jonathan Pobst  <monkey@jpobst.com>
 
        * DefaultLayoutTest.cs: Add test for docking when parent has Padding.
index e5e2aa057462384da503c83d7df33eebaac62b94..7ea5171a8478da435ddbdaae8d238631daf3c9de 100644 (file)
@@ -2192,6 +2192,22 @@ namespace MonoTests.System.Windows.Forms
 
                }
 
+               [Test] // bug #81118, 81718
+               public void VisibleTriggersLayout ()
+               {
+                       Form f = new Form ();
+                       f.ShowInTaskbar = false;
+                       
+                       Control c = new Control ();
+                       c.Visible = false;
+                       
+                       f.Controls.Add (c);
+                       
+                       c.Dock = DockStyle.Fill;
+                       c.Visible = true;
+                       
+                       Assert.AreEqual (f.ClientSize.Width, c.Width, "L1");
+               }
        }
 
        [TestFixture]