public virtual void Add(Control child) { child.Parent = owner; int idx = children.Add(child); owner.OnChildrenChanged(child, null, idx); }
/// <summary> /// Disconnects a child. /// </summary> private void DisconnectChild(int index) { Debug.Assert(items[index] != null); Control child = items[index]; // Every function that calls this function needs to call VerifyAccess to prevent // foreign threads from changing the tree. Control oldParent = child.Parent; items[index] = null; child.Parent = null; //Control.PropagateFlags(_owner, Control.Flags.IsSubtreeDirtyForRender); version++; //Control.PropagateSuspendLayout(child); oldParent.OnChildrenChanged(null /* no child added */, child, index); }