All pastes #405343 Raw Edit

Something

public text v1 · immutable
·published 2007-03-21 17:57 UTC
rendered paste body
Index: System.Windows.Forms/ChangeLog
===================================================================
--- System.Windows.Forms/ChangeLog	(revision 74754)
+++ System.Windows.Forms/ChangeLog	(working copy)
@@ -1,5 +1,11 @@
 2007-03-21  Jonathan Pobst  <monkey@jpobst.com>
 
+	* Control.cs: Don't trigger a layout if an implicit control is added
+	that isn't visible.  Don't notify the owner when an implicit control
+	is added.  (Owners shouldn't even know about their implicit controls.)
+
+2007-03-21  Jonathan Pobst  <monkey@jpobst.com>
+
 	* ScrollableControl.cs: Add implicit controls with AddRangeImplicit
 	to save some re-layouts.
 
Index: System.Windows.Forms/Control.cs
===================================================================
--- System.Windows.Forms/Control.cs	(revision 74753)
+++ System.Windows.Forms/Control.cs	(working copy)
@@ -561,8 +561,11 @@
 				control.InitLayout ();
 				if (owner.Visible)
 					owner.UpdateChildrenZOrder ();
-				owner.PerformLayout (control, "Parent");
-				owner.OnControlAdded (new ControlEventArgs (control));
+				
+				// If we are adding a new control that isn't
+				// visible, don't trigger a layout
+				if (control.is_visible)
+					owner.PerformLayout (control, "Parent");
 			}
 #if NET_2_0
 			[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]