Beispiel #1
0
        /// <summary>
        /// Pastes the copied rows to the end of the table
        /// </summary>
        /// <param name="rowsToCopy"></param>
        public void PasteTableRows(int rowsToCopy)
        {
            var table = this.tableLayoutPanel;
            List <Dictionary <int, string> > tableRowData = new List <Dictionary <int, string> >();

            //copy the rows data
            foreach (KeyValuePair <int, bool> entry in selectedRows)
            {
                //copy the row
                if (entry.Value == true)
                {
                    //we get the index of the row
                    int rowIndex = entry.Key;
                    Dictionary <int, string> row       = new Dictionary <int, string>();
                    InputDataTableRow        rowToCopy = (InputDataTableRow)table.Controls[rowIndex];
                    int i = 0;
                    foreach (TextBox textBox in rowToCopy.Controls.OfType <TextBox>())
                    {
                        row.Add(i, textBox.Text);
                        i++;
                    }
                    tableRowData.Add(row);
                }
            }

            //only if we have data to send we insert the table data
            if (tableRowData.Count > 0)
            {
                InsertTableData(tableRowData, rowsToCopy, TableRowType.InputDataRow);
            }
        }
Beispiel #2
0
        private void TableRow_RowChecked(object sender, EventArgs e)
        {
            InputDataTableRow row = sender as InputDataTableRow;
            bool isChecked        = ((CheckBox)(row.Controls[0])).Checked;

            selectedRows[row.rowIndex] = isChecked;
        }
Beispiel #3
0
        private void AddTableRowInputData()
        {
            var table     = this.tableLayoutPanel;
            int colAmount = table.ColumnCount;
            int rowIndex  = table.RowStyles.Count;
            InputDataTableRow tableRow = null;

            tableRow             = new InputDataTableRow(rowIndex);
            tableRow.RowChecked += TableRow_RowChecked;
            tableRow.Dock        = DockStyle.Fill;

            if (rowIndex % 2 == 0)
            {
                tableRow.BackColor = ColorConstants.tableBackgroundColor;
                tableRow.BackColor = ColorConstants.tableBackgroundColor;
                tableRow.setTextBoxBackgroundColor(ColorConstants.tableBackgroundColor);
            }
            else
            {
                tableRow.BackColor = Color.White;
                tableRow.BackColor = Color.White;
                tableRow.setTextBoxBackgroundColor(Color.White);
            }

            tableRow.BorderStyle = BorderStyle.None;
            table.SetColumnSpan(tableRow, colAmount);

            table.Controls.Add(tableRow, 0, rowIndex);
            table.RowStyles.Add(new RowStyle(SizeType.Absolute, 25));
        }
Beispiel #4
0
        /// <summary>
        /// Generates a table according to the amount of params and teh sizes of the colums and rows
        /// </summary>
        /// <param name="modelParams"></param>
        /// <param name="rowSize"></param>
        /// <param name="colSize"></param>
        /// <param name="colAmount"></param>
        /// <param name="amountOfRows"></param>
        public void CreateInputDataTable(List <string> modelParams, float rowSize, float colSize, int colAmount, int amountOfRows)
        {
            int rowIndex = 0;
            var table    = this.tableLayoutPanel;

            table.Controls.Clear();
            table.RowStyles.Clear();
            table.ColumnCount = colAmount;
            table.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, colSize));
            var tableRowHeader = new InputDataTableHeader();

            tableRowHeader.InitHeaderNames(modelParams);
            tableRowHeader.Dock      = DockStyle.Fill;
            tableRowHeader.BackColor = ColorConstants.tableHeaderColor;

            table.SetColumnSpan(tableRowHeader, table.ColumnCount);
            table.Controls.Add(tableRowHeader, 0, rowIndex);

            table.RowStyles.Add(new RowStyle(SizeType.Absolute, rowSize));
            rowIndex++;
            while (rowIndex < amountOfRows)
            {
                var tableRow = new InputDataTableRow(rowIndex);
                tableRow.RowChecked += TableRow_RowChecked;
                tableRow.Dock        = DockStyle.Fill;



                if (rowIndex % 2 == 0)
                {
                    tableRow.BackColor = ColorConstants.tableBackgroundColor;
                    tableRow.BackColor = ColorConstants.tableBackgroundColor;
                    tableRow.setTextBoxBackgroundColor(ColorConstants.tableBackgroundColor);
                }
                else
                {
                    tableRow.BackColor = Color.White;
                    tableRow.BackColor = Color.White;
                    tableRow.setTextBoxBackgroundColor(Color.White);
                }
                tableRow.BorderStyle = BorderStyle.None;
                table.SetColumnSpan(tableRow, colAmount);
                table.Controls.Add(tableRow, 0, rowIndex);
                table.RowStyles.Add(new RowStyle(SizeType.Absolute, rowSize));



                rowIndex++;
            }
        }