private void btnAddLine_Click(object sender, EventArgs e) { var r = new TabloidConfigRow(); Tools.AddWithUniqueName( TabloidConfig.Config.Synthese.Affichage, r, "SR"); addRow(currentTable, r); }
void renderLine(TabloidConfigRow r) { var row = addRow(panel, r); foreach (TabloidConfigCell c in r.Cellules) { addColumn(row, c); } }
/// <summary> /// Add row to tableLayoutPanel /// </summary> /// <param name="parent">TableLayoutPanel parent</param> /// <returns>newly created TableLayoutPanel representing new row</returns> private TableLayoutPanel addRow(TableLayoutPanel parent, TabloidConfigRow tcr) { var tab = new TableLayoutPanel { CellBorderStyle = TableLayoutPanelCellBorderStyle.Single, ColumnCount = 1, RowCount = 1, Dock = DockStyle.Fill, AutoSizeMode = AutoSizeMode.GrowAndShrink }; tab.Click += Tab_Click; tab.RowStyles.Add(new RowStyle(SizeType.Percent, 100f)); //add add column tab.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 40f)); var imgCtrl = new PictureBox { Dock = DockStyle.Fill, BackgroundImage = plus, BackgroundImageLayout = ImageLayout.Center }; imgCtrl.MouseDown += picAddColumn_Click; tab.Controls.Add(imgCtrl, 0, 0); //add new tab parent.SuspendLayout(); parent.RowCount++; var pos = parent.RowCount - 1; parent.RowStyles.Add(new RowStyle(SizeType.Absolute, 20f)); parent.Controls.Add(tab, 0, pos); calcSize(parent); setActive(tab); parent.ResumeLayout(); tab.Tag = tcr; return(tab); }