Преглед на файлове

2007-05-23 Jonathan Pobst <[email protected]>

	* Control.cs: Apply patch from George to call parent.PerformLayout
	when Visible is changed.  [Fixes bugs #81118, 81718]

2007-05-23  Jonathan Pobst  <[email protected]>

	* 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
Jonathan Pobst преди 18 години
родител
ревизия
2eed20dc45

+ 5 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog

@@ -1,3 +1,8 @@
+2007-05-23  Jonathan Pobst  <[email protected]>
+
+	* Control.cs: Apply patch from George to call parent.PerformLayout
+	when Visible is changed.  [Fixes bugs #81118, 81718]
+
 2007-05-23  Everaldo Canuto  <[email protected]>
 
 	* MainMenu.cs, MenuAPI.cs: Implement Collapse event for MainMenu (2.0).

+ 6 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs

@@ -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");
+				}
 			}
 		}
 

+ 5 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog

@@ -1,3 +1,8 @@
+2007-05-23  Jonathan Pobst  <[email protected]>
+
+	* ControlTest.cs: Add test to show that setting a control's Visible
+	property causes it's parent to relayout.
+
 2007-05-23  Jonathan Pobst  <[email protected]>
 
 	* DefaultLayoutTest.cs: Add test for docking when parent has Padding.

+ 16 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlTest.cs

@@ -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]