Ejemplo n.º 1
0
        private void AddTab(int index, BothTeamSettings roundSettings, string team1Name, string team2Name)
        {
            TabPage              roundTabPage    = new TabPage();
            TabControl           teamsTabControl = new TabControl();
            TabPage              team1TabPage    = new TabPage();
            TabPage              team2TabPage    = new TabPage();
            RoundUserControlBase team1Control    = CreateControlForRoundSettings(roundSettings.Team1Settings);
            RoundUserControlBase team2Control    = CreateControlForRoundSettings(roundSettings.Team2Settings);

            roundTabPage.SuspendLayout();
            teamsTabControl.SuspendLayout();
            team1TabPage.SuspendLayout();
            team2TabPage.SuspendLayout();
            team1Control.SuspendLayout();
            team2Control.SuspendLayout();

            roundTabPage.Controls.Add(teamsTabControl);
            roundTabPage.Name    = "TeamTabControl_" + index.ToString();
            roundTabPage.Padding = new System.Windows.Forms.Padding(3);
            roundTabPage.Text    = roundSettings.RoundName;
            roundTabPage.UseVisualStyleBackColor = true;

            teamsTabControl.Alignment = System.Windows.Forms.TabAlignment.Bottom;
            teamsTabControl.Controls.Add(team1TabPage);
            teamsTabControl.Controls.Add(team2TabPage);
            teamsTabControl.Dock          = System.Windows.Forms.DockStyle.Fill;
            teamsTabControl.Name          = "TeamsTabControl_" + index.ToString();
            teamsTabControl.SelectedIndex = 0;

            team1TabPage.Controls.Add(team1Control);
            team1TabPage.Name    = "Team1TabPage_" + index.ToString();
            team1TabPage.Padding = new System.Windows.Forms.Padding(3);
            team1TabPage.Text    = team1Name;
            team1TabPage.UseVisualStyleBackColor = true;

            team1Control.Dock = System.Windows.Forms.DockStyle.Fill;
            team1Control.Name = "Team1UserControl_" + index.ToString();

            team2TabPage.Controls.Add(team2Control);
            team2TabPage.Name    = "Team2TabPage_" + index.ToString();
            team2TabPage.Padding = new System.Windows.Forms.Padding(3);
            team2TabPage.Text    = team2Name;
            team2TabPage.UseVisualStyleBackColor = true;

            team2Control.Dock = System.Windows.Forms.DockStyle.Fill;
            team2Control.Name = "Team2UserControl_" + index.ToString();

            RoundsTabControl.Controls.Add(roundTabPage);

            team1Control.LoadSettings(roundSettings.Team1Settings);
            team2Control.LoadSettings(roundSettings.Team2Settings);

            team2Control.ResumeLayout(false);
            team1Control.ResumeLayout(false);
            team2TabPage.ResumeLayout(false);
            team1TabPage.ResumeLayout(false);
            teamsTabControl.ResumeLayout(false);
            roundTabPage.ResumeLayout(false);
        }
Ejemplo n.º 2
0
 private void TrySetBackground(Control control)
 {
     if (control is RoundUserControlBase)
     {
         RoundUserControlBase roundControl = (RoundUserControlBase)control;
         roundControl.SetBackgroundImage();
     }
 }