Esempio n. 1
0
 /// <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);
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
 protected virtual void OnTabPageRemoving(TabPageRemovingEventArgs e)
 {
     if (TabPageRemoving != null)
         TabPageRemoving(this, e);
 }