Exemplo n.º 1
0
 /// <summary>
 /// 窗体打开
 /// </summary>
 /// <param name="tab">要打开到的TabControl</param>
 /// <param name="caption">标题</param>
 /// <param name="allowDuplicate">是否允许打开多个</param>
 public virtual void ShowAsTabPage(SuperTabControl tabMain, bool allowDuplicate = false, string caption = "")
 {
     caption      = string.IsNullOrEmpty(caption) ? this.Text : caption;
     this.TabMain = tabMain;
     if (allowDuplicate)
     {
         OpenTabPage(tabMain, caption);
     }
     else
     {
         bool IsOpened = false;
         foreach (SuperTabItem tabitem in tabMain.Tabs)
         {
             if (tabitem.AttachedControl.Controls.Count > 0)
             {
                 if (tabitem.AttachedControl.Controls[0].GetType() == this.GetType() && tabitem.Text.Equals(caption))
                 {
                     tabMain.SelectedTab = tabitem;
                     ((CommonBaseForm)tabitem.AttachedControl.Controls[0]).OnActivated(new EventArgs());
                     IsOpened = true;
                     break;
                 }
             }
         }
         if (!IsOpened)
         {
             OpenTabPage(tabMain, caption);
         }
     }
     this.Select();
     tabMain.SelectedTabChanged += tab_SelectedTabChanged;
 }
Exemplo n.º 2
0
        private void FormTest_Load(object sender, EventArgs e)
        {
            //修改界面默认显示颜色
            this.styleManager1.ManagerStyle = eStyle.Office2010Silver;
            //默认清空所有的tab页
            SuperTabControl superTabControl = new SuperTabControl();

            superTabControl.Tabs.Clear();
            //获取用户信息
            Sys_User_Info userInfo = MemoryCache.Default.Get("userinfo") as Sys_User_Info;

            label_login_user.Text = userInfo.UserName;
            #region 手动添加菜单项test
            RibbonTabItem tabItem = new RibbonTabItem();
            tabItem.Text = "基础数据";
            RibbonPanel rpanel = new RibbonPanel();
            rpanel.Dock   = DockStyle.Fill;
            tabItem.Panel = rpanel;
            ribbonControl1.Controls.Add(rpanel);
            ribbonControl1.TitleText = "北京动车段工具管理应用系统v1.1[" + userInfo.UserName + "]";
            this.ribbonControl1.Items.Add(tabItem);
            RibbonBar rb = new RibbonBar();

            ButtonItem bi = new ButtonItem("bi");
            bi.Text = "用户管理";
            string path = "../../image/manage.ico";
            bi.Icon          = new Icon(path);
            bi.ImagePosition = eImagePosition.Top;
            rb.Items.Add(bi);
            rpanel.Controls.Add(rb);
            #endregion
        }
        /// <summary>
        /// 创建 <see cref="QueryPageContainer" />  的新实例(QueryPageContainer)
        /// </summary>
        public QueryPageContainer(Session session, Entity.QueryParam queryParam, SuperTabControl control)
        {
            Session    = session;
            QueryParam = queryParam;

            if (!Program.IsRunning)
            {
                return;
            }

            QueryPage = new QueryPage(Session, queryParam)
            {
                Dock      = DockStyle.Fill,
                BackColor = SystemColors.Window
            };
            _panel = new SuperTabControlPanel();
            _panel.Controls.Add(QueryPage);
            AttachedControl = _panel;
            _panel.TabItem  = this;
            _tabControl     = control;
            var idx = control.Tabs.OfType <QueryPageContainer>().LastOrDefault();

            _tabControl.CreateTab(this, _panel, idx == null ? 0 : control.Tabs.IndexOf(idx) + 1);

            Text  = queryParam.Name;
            Image = Properties.Resources.calendar_16;
            DataBindings.Add("Text", queryParam, "Name", false, DataSourceUpdateMode.OnPropertyChanged);
            BindQueryState();

            EnableImageAnimation = false;

            this.DoubleClick += QueryPageContainer_DoubleClick;
        }
Exemplo n.º 4
0
        void CreateTab(SuperTabControl tabControlName, string strTextSuperTabItem, string strNameSuperTabItem, string strNameSuperTabControlPanel, Office2007RibbonForm Form)
        {
            int intCheck = CheckExist(tabControlName, strNameSuperTabItem);

            if (intCheck > -1)
            {
                tabControlName.SelectedTabIndex = intCheck;
                Variable.stiSelected            = tabControlName.SelectedTab;
            }
            else
            {
                SuperTabItem sti = new SuperTabItem();
                sti.Name = strNameSuperTabItem;
                sti.Text = strTextSuperTabItem;
                SuperTabControlPanel stcp = new SuperTabControlPanel();
                stcp.Name = strNameSuperTabControlPanel;
                stcp.Dock = DockStyle.Fill;
                tabControlName.Controls.Add(stcp);
                sti.AttachedControl          = stcp;
                tabControlName.SelectedPanel = stcp;
                tabControlName.Tabs.Add(sti);
                Form.TopLevel = false;
                Form.Parent   = stcp;
                Form.Show();
                Form.Dock = DockStyle.Fill;
                tabControlName.SelectedTab = sti;
                Variable.stiSelected       = sti;
            }
        }
Exemplo n.º 5
0
        public static void Click(SideBarPanelItem sideBar,
                                 SuperTabControl superTabControl, ButtonItem ClickedButton, SuperTabItem TabItem)
        {
            Util.WriteMethodInfoToConsole();
            try
            {
                HConsole.WriteLine(LastCheckedButton.Text + " (" + LastCheckedButton.Name + ") --> unchecked");
                LastCheckedButton.Checked = false;
            }
            catch { }
            foreach (ButtonItem bi in sideBar.SubItems)
            {
                if (bi.Name == ClickedButton.Name)
                {
                    bi.Checked = true;
                    HConsole.WriteLine(bi.Text + " (" + bi.Name + ") --> is now LastCheckedButton");
                    LastCheckedButton = bi;
                }
                else
                {
                    bi.Checked = false;
                }
            }
            //System.Windows.Forms.Form MainForm = System.Windows.Forms.Application.OpenForms.Cast<System.Windows.Forms.Form>().Where(x => x.Name == "frmMain").FirstOrDefault();
            //var c = GetAllControlsOfType(MainForm, typeof(SideBar));
            //Console.WriteLine("Total ButtonItem Controls: " + c.Count());
            if (TabItem != null)
            {
                foreach (SuperTabItem sti in superTabControl.Tabs)
                {
                    if (sti.Name == TabItem.Name)
                    {
                        sti.Visible = true;
                        sti.Text    = ClickedButton.Text;
                    }
                    else
                    {
                        sti.Visible = false;
                    }
                }
                superTabControl.Visible = true;
            }
            else
            {
                superTabControl.Visible = false;
            }

            //if (!superTabControl.Visible)
            //{
            //    superTabControl.Visible = true;
            //}
        }
Exemplo n.º 6
0
 private void OpenTabPage(SuperTabControl tab, string caption, Image image)
 {
     parentTabItem        = tab.CreateTab(caption);
     parentTabItem.Name   = caption;
     parentTabItem.Text   = caption;
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
     this.TopLevel        = false;
     this.Visible         = true;
     this.Dock            = System.Windows.Forms.DockStyle.Fill;
     parentTabItem.AttachedControl.Controls.Add(this);
     tab.SelectedTab = parentTabItem;
     TabMain         = tab;
 }
Exemplo n.º 7
0
        int CheckExist(SuperTabControl tabControlName, string tabName)
        {
            int intIndex = -1;

            for (int i = 0; i < tabControlName.Tabs.Count; i++)
            {
                if (tabControlName.Tabs[i].Name == tabName)
                {
                    intIndex = i;
                    return(intIndex);
                }
            }
            return(intIndex);
        }
        public QueryNonLogin(SuperTabControl parent)
        {
            _session      = new Session("temp", true);
            _control      = parent;
            _contentPanel = new SuperTabControlPanel()
            {
                TabItem = this,
            };
            AttachedControl = _contentPanel;
            _contentPanel.Controls.Add(new QueryPage(_session, ProgramConfiguration.Instance.DefaultQuery)
            {
                Dock = DockStyle.Fill
            });
            parent.Controls.Add(_contentPanel);
            _control.Tabs.Add(this, 1);

            Text  = "查票(未登录)";
            Image = Properties.Resources.testtube_16;
        }
Exemplo n.º 9
0
        private void addTab(SuperTabControl tabControl)
        {
            SuperTabItem         tabItem  = new SuperTabItem();
            SuperTabControlPanel tabPanel = new SuperTabControlPanel();

            tabControl.Controls.Add(tabPanel);
            tabControl.Tabs.Insert(tabControl.Tabs.Count - 1, tabItem);

            //tabPanel
            tabPanel.Dock    = DockStyle.Fill;
            tabPanel.TabItem = tabItem;

            //tabItem
            tabItem.AttachedControl = tabPanel;
            tabItem.GlobalItem      = false;
            tabItem.Text            = "New";

            addTransactionTabPanel(tabPanel);
        }
Exemplo n.º 10
0
 private bool Add_SuperTab(ref SuperTabControl tabControl, string title, MyFormPage form)
 {
     try
     {
         if (CheckOpenTabs(title))
         {
             superTabControl.TabIndex = superTabControl.Tabs.Count - 1;
         }
         else
         {
             SuperTabItem tabPage = tabControl.CreateTab(title);
             tabPage.AttachedControl.Controls.Add(form._Mypanel);
             superTabControl.SelectedTabIndex = superTabControl.Tabs.Count - 1;
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 11
0
        public UserTabDnb(Session session, SuperTabControl parent)
        {
            InitSession(session);

            _userPage = new UserMainPageContent(session)
            {
                Dock      = DockStyle.Fill,
                BackColor = SystemColors.Window
            };
            _panel = new SuperTabControlPanel();
            _panel.Controls.Add(_userPage);
            _panel.TabItem  = this;
            AttachedControl = _panel;
            parent.Controls.Add(_panel);

            //set property
            Text = session.DisplayText;
            session.UserKeyData.DisplayNameChanged += (s, e) =>
            {
                var action = new Action(() =>
                {
                    Text = Session.DisplayText;
                });
                AppContext.MainForm.UiInvoke(action);
            };
            TaskManager.Instance.EnqueueTask("获得账号【" + session.UserName + "】的注册用户姓名", () => new GetDisplayNameWorker()
            {
                Session = Session
            }.Run());
            Image = session.TemporaryMode ? Properties.Resources.cou_16_protection : session.ShadowMode ? Properties.Resources.cou_16_users : Properties.Resources.user_16;


            //find index
            _controlParent = parent;
            var last = parent.Tabs.OfType <UserTabDnb>().LastOrDefault();
            var idx  = last == null ? 1 : parent.Tabs.IndexOf(last) + 1;

            parent.Tabs.Add(this, idx);
        }
Exemplo n.º 12
0
        public void AddTab(string tabName, SuperTabControlPanel tabPanel)
        {
            SuperTabControl tabControl = this.SuperTabControl1;

            if (tabControl == null)
            {
                throw new Exception("无法找到SuperTabControl。");
            }

            tabControl.SuspendLayout();

            SuperTabItem tabItem = new SuperTabItem();

            tabControl.Controls.Add(tabPanel);

            tabControl.Tabs.Add(tabItem);
            tabPanel.TabItem = tabItem;

            tabItem.Text            = tabName;
            tabItem.AttachedControl = tabPanel;
            tabControl.ResumeLayout(false);
        }
Exemplo n.º 13
0
        public override void Initialize(IComponent component)
        {
            base.Initialize(component);

            if (component.Site.DesignMode == true)
            {
                _TabControl = component as SuperTabControl;

                if (_TabControl != null)
                {
                    TabStrip = _TabControl.TabStrip;

                    if (Inherited == true)
                    {
                        if (_TabControl.TabsVisible == false)
                            _TabControl.TabsVisible = true;

                        if (_TabControl.SelectedPanel != null)
                            _TabControl.SelectedPanel.BringToFront();
                    }
                    _TabControl.TabStrip.GetBaseItemContainer().SetDesignMode(true);
                }
            }
        }
Exemplo n.º 14
0
        private void btnChybne_Click(object sender, EventArgs e)
        {
            ComboBoxEx       Objednavka    = Parent.Parent.Controls.Find("comboObjednavka", true).FirstOrDefault() as ComboBoxEx;
            MaskedTextBoxAdv PoradoveCislo = Parent.Parent.Controls.Find("PoradoveCislo", true).FirstOrDefault() as MaskedTextBoxAdv;
            ComboBoxEx       Zakazka       = Parent.Parent.Controls.Find("comboBoxEx1", true).FirstOrDefault() as ComboBoxEx;
            TextBoxX         Rework        = Parent.Parent.Controls.Find("txtRework", true).FirstOrDefault() as TextBoxX;
            ComboBoxEx       chyba_kto1    = Parent.Parent.Controls.Find("comboTree1", true).FirstOrDefault() as ComboBoxEx;
            ComboBoxEx       chyba_kto2    = Parent.Parent.Controls.Find("comboTree2", true).FirstOrDefault() as ComboBoxEx;
            TextBoxX         cas           = Parent.Parent.Controls.Find("textBoxX2", true).FirstOrDefault() as TextBoxX;
            RichTextBoxEx    popis_chyby   = Parent.Parent.Controls.Find("txtPopisChyby", true).FirstOrDefault() as RichTextBoxEx;
            TextBoxX         zakaznik      = Parent.Parent.Controls.Find("zakaznik", true).FirstOrDefault() as TextBoxX;
            SuperTabControl  tab_form      = Parent.Parent.Controls.Find("tabFormulare", true).FirstOrDefault() as SuperTabControl;

            if (string.IsNullOrWhiteSpace(popis_chyby.Text) || string.IsNullOrWhiteSpace(chyba_kto1.Text) || string.IsNullOrWhiteSpace(chyba_kto2.Text) || string.IsNullOrWhiteSpace(cas.Text))
            {
                MessageBox.Show("Musíš vyplniť všetky povinné polia v karte Záznam chýb!");
                tab_form.SelectedTabIndex = 1;
                return;
            }

            Class1.send_message_chyba(Objednavka.Text + "/" + PoradoveCislo.Text, Convert.ToString(Zakazka.Text), Rework.Text, textBoxItem2.Text, prihlaseny, chyba_kto1.Text + "/" + chyba_kto2.Text, cas.Text, popis_chyby.Text, zakaznik.Text);
            comboBoxItem3.Text = "CHYBA";
            comboBoxItem3.Refresh();
        }
Exemplo n.º 15
0
 public SuperTabControlManager(SuperTabControl superTabControl)
 {
     this.superTabControl = superTabControl;
 }
        private void SetupBackstageTab(SuperTabControl backstageTab, IDesignerHost dh)
        {
            backstageTab.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            backstageTab.ControlBox.Visible = false;
            backstageTab.ItemPadding.Left = 6;
            backstageTab.ItemPadding.Right = 4;
            backstageTab.ItemPadding.Top = 4;
            backstageTab.ReorderTabsEnabled = false;
            try
            {
                backstageTab.SelectedTabFont = new System.Drawing.Font("Segoe UI", 9.75F);
            }
            catch { }
            backstageTab.SelectedTabIndex = 0;
            backstageTab.Size = new System.Drawing.Size(614, 315);
            backstageTab.TabAlignment = DevComponents.DotNetBar.eTabStripAlignment.Left;
            try
            {
                backstageTab.TabFont = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            }
            catch { }
            backstageTab.TabHorizontalSpacing = 16;
            backstageTab.TabStyle = DevComponents.DotNetBar.eSuperTabStyle.Office2010BackstageBlue;
            backstageTab.TabVerticalSpacing = 8;

            SuperTabControlDesigner tabDesigner = dh.GetDesigner(backstageTab) as SuperTabControlDesigner;
            if (tabDesigner != null)
            {
                ButtonItem button;
                // Save button
                button = tabDesigner.CreateButton();
                SetProperty(button, "Text", "Save");
                SetProperty(button, "KeyTips", "S");
                SetProperty(button, "Image", RibbonControlDesigner.LoadImage("Save16.png"));

                // Open
                button = tabDesigner.CreateButton();
                SetProperty(button, "Text", "Open");
                SetProperty(button, "KeyTips", "O");
                SetProperty(button, "Image", RibbonControlDesigner.LoadImage("Open.png"));

                // Close
                button = tabDesigner.CreateButton();
                SetProperty(button, "Text", "Close");
                SetProperty(button, "KeyTips", "C");
                SetProperty(button, "Image", RibbonControlDesigner.LoadImage("Close16.png"));

                SuperTabItem tab;
                tab = tabDesigner.CreateNewTab();
                SetProperty(tab, "Text", "Recent");
                SetProperty(tab, "KeyTips", "R");
                //SetProperty((SuperTabControlPanel)tab.AttachedControl, "BackgroundImage", RibbonControlDesigner.LoadImage("BlueBackstageBgImage.png"));
                //SetProperty((SuperTabControlPanel)tab.AttachedControl, "BackgroundImagePosition", DevComponents.DotNetBar.eStyleBackgroundImage.BottomRight);

                tab = tabDesigner.CreateNewTab();
                SetProperty(tab, "Text", "New");
                SetProperty(tab, "KeyTips", "N");
                //SetProperty((SuperTabControlPanel)tab.AttachedControl, "BackgroundImage", RibbonControlDesigner.LoadImage("BlueBackstageBgImage.png"));
                //SetProperty((SuperTabControlPanel)tab.AttachedControl, "BackgroundImagePosition", DevComponents.DotNetBar.eStyleBackgroundImage.BottomRight);

                tab = tabDesigner.CreateNewTab();
                SetProperty(tab, "Text", "Print");
                SetProperty(tab, "KeyTips", "P");
                //SetProperty((SuperTabControlPanel)tab.AttachedControl, "BackgroundImage", RibbonControlDesigner.LoadImage("BlueBackstageBgImage.png"));
                //SetProperty((SuperTabControlPanel)tab.AttachedControl, "BackgroundImagePosition", DevComponents.DotNetBar.eStyleBackgroundImage.BottomRight);

                tab = tabDesigner.CreateNewTab();
                SetProperty(tab, "Text", "Help");
                SetProperty(tab, "KeyTips", "H");
                SetProperty((SuperTabControlPanel)tab.AttachedControl, "BackgroundImage", RibbonControlDesigner.LoadImage("BlueBackstageBgImage.png"));
                SetProperty((SuperTabControlPanel)tab.AttachedControl, "BackgroundImagePosition", DevComponents.DotNetBar.eStyleBackgroundImage.BottomRight);

                // Options
                button = tabDesigner.CreateButton();
                SetProperty(button, "Text", "Options");
                SetProperty(button, "KeyTips", "T");
                SetProperty(button, "Image", RibbonControlDesigner.LoadImage("Options2.png"));

                // Exit
                button = tabDesigner.CreateButton();
                SetProperty(button, "Text", "Exit");
                SetProperty(button, "KeyTips", "X");
                SetProperty(button, "Image", RibbonControlDesigner.LoadImage("Exit2.png"));
            }
        }
Exemplo n.º 17
0
        private void OnBackstageTabChanged(SuperTabControl oldValue, SuperTabControl newValue)
        {
            if (oldValue != null)
            {
                oldValue.Leave -= BackstageTabLeave;
                if (oldValue.TabStrip != null) oldValue.TabStrip.ApplicationButton = null;
            }

            if (this.Expanded) this.Expanded = false;
            if (newValue != null)
            {
                newValue.Visible = false;
                newValue.Leave += BackstageTabLeave;
                if (newValue.TabStrip != null) newValue.TabStrip.ApplicationButton = this;
            }
        }
Exemplo n.º 18
0
 internal void BackstageTabClosed(SuperTabControl tabControl)
 {
     if (_AltFocusedControl == tabControl || _AltFocusedControl == tabControl.TabStrip)
         _AltFocusedControl = null;
 }