protected virtual void DisplayCreatedControls(TableLayoutPanel panel)
 {
     panel.RowCount    = RowCount;
     panel.ColumnCount = ColumnCount;
     NuGenHelperFunctions.CopyListElements(CreatedControls, panel.Controls);
     NuGenHelperFunctions.CopyListElements(ColumnStyles, panel.ColumnStyles);
     NuGenHelperFunctions.CopyListElements(RowStyles, panel.RowStyles);
 }
        public void DisplayControls(TableLayoutPanel panel)
        {
            panel.Visible = false;

            if (IsInitialized)
            {
                DisplayCreatedControls(panel);
            }
            else
            {
                CreateControls(panel);
                ColumnCount = panel.ColumnCount;
                RowCount    = panel.RowCount;

                if (panel.Controls.Count > 0)
                {
                    CreatedControls = new List <Control>(panel.Controls.Count);
                    NuGenHelperFunctions.CopyListElements(panel.Controls, CreatedControls);
                }

                if (panel.ColumnStyles.Count > 0)
                {
                    ColumnStyles = new List <ColumnStyle>(panel.ColumnStyles.Count);
                    NuGenHelperFunctions.CopyListElements(panel.ColumnStyles, ColumnStyles);
                }

                if (panel.RowStyles.Count > 0)
                {
                    RowStyles = new List <RowStyle>(panel.RowStyles.Count);
                    NuGenHelperFunctions.CopyListElements(panel.RowStyles, RowStyles);
                }

                IsInitialized = true;
            }

            panel.Visible = true;
        }