示例#1
0
        public PanelTabElement AddTabPanel(Panel panel, ToolStripItem button = null)
        {
            //if (control.GetType() != typeof(Panel))
            //    throw new PBException("only Panel can be add to PanelTabControl");
            PanelTabElement tabElement = new PanelTabElement();

            tabElement.Index  = _tabControls.Count;
            tabElement.Panel  = panel;
            tabElement.Button = button;
            //if (_tabControls.Count == 0)
            if (_selectedElement == null)
            {
                //_selectedIndex = 0;
                //_selectedControl = control;
                _selectedElement = tabElement;
                panel.Visible    = true;
                if (button != null)
                {
                    button.BackColor = _buttonSelectedColor;
                }
            }
            else // if (_tabControls.Count > 0)
            {
                panel.Visible = false;
                if (button != null)
                {
                    button.BackColor = _buttonUnselectedColor;
                }
            }
            _tabControlsDictionary.Add(panel, _tabControls.Count);
            //_tabControls.Add(control);
            _tabControls.Add(tabElement);
            this.Controls.Add(panel);
            return(tabElement);
        }
示例#2
0
        public PanelTabElement CreateTabPanel(string buttonText, Color?backColor = null)
        {
            Panel           panel      = zForm.CreatePanel(dockStyle: DockStyle.Fill, backColor: backColor);
            ToolStripButton button     = zForm.CreateToolStripButton(buttonText);
            PanelTabElement tabElement = AddTabPanel(panel, button);

            button.Tag    = tabElement.Index;
            button.Click += (sender, eventArgs) => SelectTab((int)button.Tag);
            return(tabElement);
        }
示例#3
0
 private void SelectTab(PanelTabElement element)
 {
     if (_selectedElement != null)
     {
         _selectedElement.Panel.Visible = false;
         if (_selectedElement.Button != null)
             _selectedElement.Button.BackColor = _buttonUnselectedColor;
     }
     _selectedElement = element;
     _selectedElement.Panel.Visible = true;
     if (_selectedElement.Button != null)
         _selectedElement.Button.BackColor = _buttonSelectedColor;
 }
示例#4
0
 private void SelectTab(PanelTabElement element)
 {
     if (_selectedElement != null)
     {
         _selectedElement.Panel.Visible = false;
         if (_selectedElement.Button != null)
         {
             _selectedElement.Button.BackColor = _buttonUnselectedColor;
         }
     }
     _selectedElement = element;
     _selectedElement.Panel.Visible = true;
     if (_selectedElement.Button != null)
     {
         _selectedElement.Button.BackColor = _buttonSelectedColor;
     }
 }
示例#5
0
        public Panel AddResultPanel(string buttonText, Color?backColor = null)
        {
            //ToolStripButton button = zForm.CreateToolStripButton(buttonText);
            //button.Tag = _resultTab.Controls.Count;
            //button.Click += (sender, eventArgs) => SelectResultTab((int)button.Tag);
            //_bottomToolStrip.Items.Add(button);

            //Panel panel = zForm.CreatePanel(dockStyle: DockStyle.Fill, backColor: backColor);
            ////_resultTab.Controls.Add(panel);
            //_resultTab.AddTabPanel(panel, button);

            PanelTabElement tabElement = _resultTab.CreateTabPanel(buttonText, backColor);

            _bottomToolStrip.Items.Add(tabElement.Button);

            //return panel;
            return(tabElement.Panel);
        }
示例#6
0
 public PanelTabElement AddTabPanel(Panel panel, ToolStripItem button = null)
 {
     //if (control.GetType() != typeof(Panel))
     //    throw new PBException("only Panel can be add to PanelTabControl");
     PanelTabElement tabElement = new PanelTabElement();
     tabElement.Index = _tabControls.Count;
     tabElement.Panel = panel;
     tabElement.Button = button;
     //if (_tabControls.Count == 0)
     if (_selectedElement == null)
     {
         //_selectedIndex = 0;
         //_selectedControl = control;
         _selectedElement = tabElement;
         panel.Visible = true;
         if (button != null)
             button.BackColor = _buttonSelectedColor;
     }
     else // if (_tabControls.Count > 0)
     {
         panel.Visible = false;
         if (button != null)
             button.BackColor = _buttonUnselectedColor;
     }
     _tabControlsDictionary.Add(panel, _tabControls.Count);
     //_tabControls.Add(control);
     _tabControls.Add(tabElement);
     this.Controls.Add(panel);
     return tabElement;
 }