コード例 #1
0
        private void OnAfterRemove(ToolStripItem item)
        {
            if (_itemsCollection)
            {
                ToolStrip parent = null;
                if (item != null)
                {
                    parent = item.ParentInternal;
                    item.SetOwner(null);
                }

                if (_owner != null)
                {
                    _owner.OnItemRemovedInternal(item);

                    if (!_owner.IsDisposingItems)
                    {
                        ToolStripItemEventArgs e = new ToolStripItemEventArgs(item);
                        _owner.OnItemRemoved(e);

                        // dont fire the ItemRemoved event for Overflow
                        // it would fire constantly.... instead clear any state if the item
                        // is really being removed from the master collection.
                        if (parent != null && parent != _owner)
                        {
                            parent.OnItemVisibleChanged(e, /*performLayout*/ false);
                        }
                    }
                }
            }
        }
コード例 #2
0
 private void SetOwner(ToolStripItem item)
 {
     if (this.itemsCollection && (item != null))
     {
         if (item.Owner != null)
         {
             item.Owner.Items.Remove(item);
         }
         item.SetOwner(this.owner);
         if (item.Renderer != null)
         {
             item.Renderer.InitializeItem(item);
         }
     }
 }
コード例 #3
0
        private void SetOwner(ToolStripItem item)
        {
            if (_itemsCollection)
            {
                if (item is not null)
                {
                    if (item.Owner is not null)
                    {
                        item.Owner.Items.Remove(item);
                    }

                    item.SetOwner(_owner);
                    if (item.Renderer is not null)
                    {
                        item.Renderer.InitializeItem(item);
                    }
                }
            }
        }
コード例 #4
0
 private void OnAfterRemove(ToolStripItem item)
 {
     if (this.itemsCollection)
     {
         ToolStrip parentInternal = null;
         if (item != null)
         {
             parentInternal = item.ParentInternal;
             item.SetOwner(null);
         }
         if ((this.owner != null) && !this.owner.IsDisposingItems)
         {
             ToolStripItemEventArgs e = new ToolStripItemEventArgs(item);
             this.owner.OnItemRemoved(e);
             if ((parentInternal != null) && (parentInternal != this.owner))
             {
                 parentInternal.OnItemVisibleChanged(e, false);
             }
         }
     }
 }
コード例 #5
0
        private void SetOwner(ToolStripItem item) {

            if (itemsCollection) {
              
                if (item != null) {
                    if (item.Owner != null) {
                        item.Owner.Items.Remove(item);
                    }

                    item.SetOwner(owner);
                    if (item.Renderer != null) {
                        item.Renderer.InitializeItem(item);
                    }
                }
            }
        }
コード例 #6
0
        /// <devdoc>
        ///  Do proper cleanup of ownership, etc.
        /// </devdoc>
        private void OnAfterRemove(ToolStripItem item) {
            if (itemsCollection) {
                ToolStrip parent = null; 
                if (item != null) {
                    parent = item.ParentInternal;
                    item.SetOwner(null);
                }

                if (owner != null) {
                    if (!owner.IsDisposingItems) {
                        ToolStripItemEventArgs e = new ToolStripItemEventArgs(item);
                        owner.OnItemRemoved(e);

                        // VSWhidbey 505129
                        // dont fire the ItemRemoved event for Overflow
                        // it would fire constantly.... instead clear any state if the item
                        // is really being removed from the master collection.
                        if (parent != null && parent != owner) {
                            parent.OnItemVisibleChanged(e, /*performLayout*/false);
                        }
                    }
                }
                
            }
        }
 private void OnAfterRemove(ToolStripItem item)
 {
     if (this.itemsCollection)
     {
         ToolStrip parentInternal = null;
         if (item != null)
         {
             parentInternal = item.ParentInternal;
             item.SetOwner(null);
         }
         if ((this.owner != null) && !this.owner.IsDisposingItems)
         {
             ToolStripItemEventArgs e = new ToolStripItemEventArgs(item);
             this.owner.OnItemRemoved(e);
             if ((parentInternal != null) && (parentInternal != this.owner))
             {
                 parentInternal.OnItemVisibleChanged(e, false);
             }
         }
     }
 }