/// <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.º 2
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.º 3
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);
     }
 }