protected virtual void OnTabPageRemoved(TabPageRemovedEventArgs e)
 {
     if (TabPageRemoved != null)
         TabPageRemoved(this, e);
 }
 /// <summary>
 /// Removes a NeoTabPage control from the control collection at the specified indexed location if it supports removing.
 /// </summary>
 /// <param name="toBeRemovedIndex">to be removed tab page index</param>
 public void RemoveAt(int toBeRemovedIndex)
 {
     // Check to see if there is an item at the supplied index.
     if ((toBeRemovedIndex >= TabPages.Count) || (toBeRemovedIndex < 0))
     {
         throw new IndexOutOfRangeException();
     }
     else
     {
         NeoTabPage tp = TabPages[toBeRemovedIndex] as NeoTabPage;
         if (tp.IsCloseable)
         {
             using (TabPageRemovingEventArgs e =
                 new TabPageRemovingEventArgs(tp, toBeRemovedIndex))
             {
                 OnTabPageRemoving(e);
                 if (!e.Cancel)
                 {
                     TabPages.RemoveAt(toBeRemovedIndex);
                     using (TabPageRemovedEventArgs ea =
                         new TabPageRemovedEventArgs(tp, toBeRemovedIndex))
                     {
                         OnTabPageRemoved(ea);
                     }
                 }
             }
         }
     }
 }