コード例 #1
0
 protected internal virtual void OnTabStripItemClosing(TabStripItemClosingEventArgs e)
 {
     if (this.TabStripItemClosing != null)
     {
         this.TabStripItemClosing(e);
     }
 }
コード例 #2
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            HitTestResult hitTestResult = HitTest(e.Location);

            if (hitTestResult == HitTestResult.TabItem)
            {
                BrowserTabStripItem tabItemByPoint = GetTabItemByPoint(e.Location);
                if (tabItemByPoint != null)
                {
                    SelectedItem = tabItemByPoint;
                    Invalidate();
                }
            }
            else
            {
                if (e.Button != MouseButtons.Left || hitTestResult != 0)
                {
                    return;
                }
                if (SelectedItem != null)
                {
                    TabStripItemClosingEventArgs tabStripItemClosingEventArgs = new TabStripItemClosingEventArgs(SelectedItem);
                    OnTabStripItemClosing(tabStripItemClosingEventArgs);
                    if (!tabStripItemClosingEventArgs.Cancel && SelectedItem.CanClose)
                    {
                        RemoveTab(SelectedItem);
                        OnTabStripItemClosed(EventArgs.Empty);
                    }
                }
                Invalidate();
            }
        }
コード例 #3
0
        private void OnTabClosing(SharpBrowser.BrowserTabStrip.TabStripItemClosingEventArgs e)
        {
            // exit if invalid tab
            if (CurTab == null)
            {
                e.Cancel = true;
                return;
            }

            // add a blank tab if the very last tab is closed!
            if (TabPages.Items.Count <= 2)
            {
                AddBlankTab();
                //e.Cancel = true;
            }
        }