internal void Init(TableSettings table) { tlpColumns.ColumnCount = table.Columns.Count; tlpColumns.ColumnStyles.Clear(); tlpColumns.RowStyles.Clear(); for (int i = 0; i < table.Columns.Count; i++) { this.tlpColumns.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, table.Columns[i].Percentage)); tlpColumns.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single; if (table.Columns[i].Name.Equals("Date")) { DateTimePicker textbox = new DateTimePicker(); textbox.Format = DateTimePickerFormat.Short; tlpColumns.Controls.Add(textbox); tlpColumns.SetColumn(textbox, i); tlpColumns.SetRow(textbox, 0); textbox.Dock = DockStyle.Fill; } else { TextBox textbox = new TextBox(); tlpColumns.Controls.Add(textbox); tlpColumns.SetColumn(textbox, i); tlpColumns.SetRow(textbox, 0); textbox.Dock = DockStyle.Fill; } } }
private void AddTable(TableSettings tableSett) { ucTableSettings table = new ucTableSettings(); table.OnTableDeleted += Table_OnTableDeleted; table.OnColumnSizeChanged += Table_OnColumnSizeChanged; pnlContent.Controls.Add(table); table.Dock = DockStyle.Top; table.BringToFront(); pnlContent.Height += table.Height; table.Init(tableSett); }
private void AddTable(TableSettings table) { ucTable ucControl = new ucTable(); //ucControl.OnRowDeleted += UcControl_OnRowDeleted; //ucControl.OnRowAdded += UcControl_OnRowAdded; panelMain.Controls.Add(ucControl); ucControl.Dock = DockStyle.Top; ucControl.BringToFront(); panelMain.Height += ucControl.Height; ucControl.Init(table); }
internal void Init(TableSettings tableSett) { if (tableSett != null) { cmbSeScade.SelectedIndex = tableSett.SeScade ? 1 : 0; txtHeader.Text = tableSett.Header; foreach (var col in tableSett.Columns) { AddColumn(col); } } else { AddColumn(null); } }
public TableSettings GetTable() { TableSettings tableSettings = new TableSettings(); tableSettings.Header = txtHeader.Text; if (cmbSeScade.SelectedIndex < 0) { cmbSeScade.SelectedIndex = 0; } tableSettings.SeScade = Convert.ToBoolean(cmbSeScade.SelectedIndex); for (int i = grpName.Controls.Count - 1; i >= 0; i--) { var control = grpName.Controls[i]; if (control is ucColumnSettings) { tableSettings.Columns.Add((control as ucColumnSettings).GetColumnSettings()); } } return(tableSettings); }