Exemplo n.º 1
0
        public void AddPage(IControlPage page, string name)
        {
            TabPage     tabPage = new TabPage(name);
            UserControl control = page as UserControl;

            tabPage.Controls.Add(control);
            control.Dock = DockStyle.Fill;

            tabPages.TabPages.Add(tabPage);
            tabPages.SelectedTab = tabPage;
            page.Start();
        }
Exemplo n.º 2
0
 void AddControlPage(BotPage botPage, IControlPage control, string name)
 {
     if (botPage.controls == null)
     {
         botPage.controls      = new ControlBotPages();
         botPage.controls.Dock = DockStyle.Fill;
         botPage.page.Controls.Add(botPage.controls);
         botPage.controls.Start();
     }
     botPage.controls.AddPage(control, name);
     tabsOpenBots.SelectedTab = botPage.page;
 }
Exemplo n.º 3
0
 public void Stop()
 {
     foreach (TabPage page in tabPages.TabPages)
     {
         foreach (Control control in page.Controls)
         {
             IControlPage controlPage = control as IControlPage;
             if (controlPage != null)
             {
                 controlPage.Stop();
             }
         }
     }
 }
Exemplo n.º 4
0
        private void tabPages_MouseDown(object sender, MouseEventArgs e)
        {
            Rectangle textRect  = tabPages.GetTabRect(tabPages.SelectedIndex);
            Bitmap    bmp       = global::CmdManager.Properties.Resources.close_16;
            Rectangle closeArea = new Rectangle(textRect.X + textRect.Width - bmp.Width, (textRect.Height - bmp.Height) / 2, bmp.Width, bmp.Height);

            if (closeArea.Contains(e.X, e.Y))
            {
                foreach (Control control in tabPages.SelectedTab.Controls)
                {
                    IControlPage controlPage = control as IControlPage;
                    if (controlPage != null)
                    {
                        controlPage.Stop();
                    }
                }
                tabPages.TabPages.Remove(tabPages.SelectedTab);
            }
        }