Exemplo n.º 1
0
 private void ShowTab(TabControl tabControl, TabPage page)
 {
     if (!tabControl.Contains(page))
     {
         tabControl.TabPages.Add(page);
     }
     tabControl.SelectedTab = page;
 }
Exemplo n.º 2
0
 public static void HideTabPage(TabControl unTabControl, TabPage unTabPage)
 {
     if (unTabControl.Contains(unTabPage))
     {
         foreach (TabPage t in unTabControl.TabPages)
         {
             if (!AllTabPages.Contains(t))
             {
                 AllTabPages.Add(t);
             }
         }
         unTabControl.TabPages.Remove(unTabPage);
     }
 }
Exemplo n.º 3
0
 protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos);
Exemplo n.º 4
0
 public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos);
Exemplo n.º 5
0
        public static void UpdateFuncAssign(string Form, string Control, string active)
        {
            try
            {
                Form form = Application.OpenForms[Form];

                if (form == null)
                {
                    return;
                }

                if (form.InvokeRequired)
                {
                    UpdateFuncEnable_D ph = new UpdateFuncEnable_D(UpdateFuncAssign);
                    form.BeginInvoke(ph, Form, Control, active);
                }
                else
                {
                    //20190531 Add tab controller 移除頁面功能
                    if (Control.IndexOf(".") > 0)
                    {
                        string     tabCtrlName = Control.Substring(0, Control.IndexOf("."));
                        TabControl control     = form.Controls.Find(tabCtrlName, true).FirstOrDefault() as TabControl;
                        string     tabPageName = Control.Substring(Control.IndexOf(".") + 1);
                        tabPages.TryGetValue(tabPageName, out TabPage foo);
                        if (control != null && foo != null)
                        {
                            switch (active)
                            {
                            case "Y":
                                if (!control.Contains(foo))
                                {
                                    control.TabPages.Add(foo);
                                }
                                break;

                            case "N":
                                if (control.Contains(foo))
                                {
                                    control.TabPages.Remove(foo);
                                }
                                break;
                            }
                        }
                        else
                        {
                            MessageBox.Show("Control not found. Form:" + Form + " Control:" + tabPageName + " active" + active);
                        }
                    }
                    else
                    {
                        Control control = form.Controls.Find(Control, true).FirstOrDefault() as Control;
                        if (control != null)
                        {
                            switch (active)
                            {
                            case "Y":
                                control.Enabled = true;
                                break;

                            case "N":
                                control.Enabled = false;
                                break;
                            }
                        }
                        else
                        {
                            MessageBox.Show("Control not found. Form:" + Form + " Control:" + Control + " active" + active);
                        }
                    }
                }
            }
            catch
            {
                logger.Error("UpdateFuncAssign: Update fail. Form:" + Form + " Control:" + Control + " active" + active);
            }
        }