示例#1
0
        /// <summary>Close a tab.</summary>
        /// <param name="o">A widget appearing on the tab</param>
        public void CloseTabContaining(object o)
        {
            Notebook notebook = null;
            string   tabText  = null;
            int      tabPage  = GetTabOfWidget(o, ref notebook, ref tabText);

            if (tabPage > 0)
            {
                TabClosingEventArgs args = new TabClosingEventArgs();
                if (TabClosing != null)
                {
                    args.LeftTabControl = IsControlOnLeft(o);
                    args.Name           = tabText;
                    args.Index          = tabPage;
                    TabClosing.Invoke(this, args);
                }
            }
        }
示例#2
0
        /// <summary>User is closing a tab.</summary>
        private void OnCloseTabClick2(object sender, EventArgs e)
        {
            TabClosingEventArgs args = new TabClosingEventArgs();

            args.LeftTabControl = false;

            if (TabClosing != null)
            {
                args.Name  = tabControl2.SelectedTab.Text;
                args.Index = tabControl2.SelectedIndex;
                TabClosing.Invoke(this, args);
            }

            if (args.AllowClose && tabControl2.SelectedTab.Text != indexTabText)
            {
                tabControl2.TabPages.Remove(tabControl2.SelectedTab);
            }
        }
示例#3
0
文件: MainView.cs 项目: hol353/ApsimX
        public void on_eventbox1_button_press_event(object o, ButtonPressEventArgs e)
        {
            if (e.Event.Button == 2)
            {

                Notebook notebook = null;
                string tabText = null;
                int tabPage = GetTabOfWidget(o, ref notebook, ref tabText);
                if (tabPage > -1)
                    notebook.CurrentPage = tabPage;
                if (tabPage > 0)
                {
                    TabClosingEventArgs args = new TabClosingEventArgs();
                    if (TabClosing != null)
                    {
                        args.LeftTabControl = IsControlOnLeft(o);
                        args.Name = tabText;
                        args.Index = tabPage;
                        TabClosing.Invoke(this, args);
                    }
                    if (args.AllowClose)
                        notebook.RemovePage(tabPage);
                }
            }
        }
示例#4
0
文件: MainView.cs 项目: hol353/ApsimX
 /// <summary>Close a tab.</summary>
 /// <param name="o">A widget appearing on the tab</param>
 public void CloseTabContaining(object o)
 {
     Notebook notebook = null;
     string tabText = null;
     int tabPage = GetTabOfWidget(o, ref notebook, ref tabText);
     if (tabPage > 0)
     {
         TabClosingEventArgs args = new TabClosingEventArgs();
         if (TabClosing != null)
         {
             args.LeftTabControl = IsControlOnLeft(o);
             args.Name = tabText;
             args.Index = tabPage;
             TabClosing.Invoke(this, args);
         }
         if (args.AllowClose)
             notebook.RemovePage(tabPage);
     }
 }
示例#5
0
文件: MainView.cs 项目: hol353/ApsimX
        /// <summary>User is closing a tab.</summary>
        private void OnCloseTabClick2(object sender, EventArgs e)
        {
            TabClosingEventArgs args = new TabClosingEventArgs();
            args.LeftTabControl = false;

            if (TabClosing != null)
            {
                args.Name = tabControl2.SelectedTab.Text;
                args.Index = tabControl2.SelectedIndex;
                TabClosing.Invoke(this, args);
            }

            if (args.AllowClose && tabControl2.SelectedTab.Text != indexTabText)
                tabControl2.TabPages.Remove(tabControl2.SelectedTab);
        }