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);
}
}
}
}
}