private void RemoveItem(ToolStripItem item)
{
int index;
try
{
index = this._itemList.IndexOf(item);
this._itemList.Remove(item);
}
finally
{
item.Dispose();
}
if (this._itemList.Count > 0)
{
this.listBoxItems.ClearSelected();
index = Math.Max(0, Math.Min(index, this.listBoxItems.Items.Count - 1));
this.listBoxItems.SelectedIndex = index;
}
}