private void btnAddColumn_Click(object sender, EventArgs e) { UpdateLayoutForColumn(); var columnControl = new ColumnSettings(CurrentState, "#" + (ColumnsList.Count + 1), ColumnsList); ColumnsList.Add(columnControl); AddColumnToLayout(columnControl, ColumnsList.Count); foreach (var column in ColumnsList) column.UpdateEnabledButtons(); }
private void AddColumnToLayout(ColumnSettings column, int index) { tableColumns.Controls.Add(column, 0, index); tableColumns.SetColumnSpan(column, 4); column.ColumnRemoved -= column_ColumnRemoved; column.MovedUp -= column_MovedUp; column.MovedDown -= column_MovedDown; column.ColumnRemoved += column_ColumnRemoved; column.MovedUp += column_MovedUp; column.MovedDown += column_MovedDown; }