Exemple #1
0
        //Methods
        //===============================================================================================

        //Method resposible for generating appropriate table of buttons
        public void CreateTableCellButtons(int verticalStartPosiotion, int horizontalStartPosiotion,
                                           int numberOfRows, int numberOfColumns)
        {
            int localVerticalPositon = verticalStartPosiotion;
            int localHorizontalPosition;
            int labelCounter = 1;

            table.NumberOfColumns = numberOfColumns;
            table.NumberOfRows    = numberOfRows;

            for (int i = 0; i < numberOfRows; i++)
            {
                localHorizontalPosition = horizontalStartPosiotion;
                for (int j = 0; j < numberOfColumns; j++)
                {
                    TableCellButton tableCellButton = new TableCellButton(labelCounter, i + 1, j + 1);
                    tableCellButton.Left   = localHorizontalPosition;
                    tableCellButton.Top    = localVerticalPositon;
                    tableCellButton.Height = 35;
                    tableCellButton.Text   = labelCounter.ToString();
                    tableCellButton.Click += new EventHandler(SelectingCell);
                    table.TableCellButtonList.Add(tableCellButton);
                    tableCustomizationView.ControllsAdd(tableCellButton);
                    labelCounter++;
                    localHorizontalPosition += 85;
                }
                localVerticalPositon += 37;
            }
        }
Exemple #2
0
        //Method resposible for inserting selected buttons indexes into list
        public void SelectingCell(object sender, EventArgs e)
        {
            TableCellButton selectedCellButton = (TableCellButton)sender;

            if (!selectedCellButton.IsChosen)
            {
                tableCustomizationView.SelectedCells.Add(selectedCellButton.Index);
            }
            else
            {
                tableCustomizationView.SelectedCells.Remove(selectedCellButton.Index);
            }
        }
Exemple #3
0
 public void MergeCells()
 {
     if (MergedCellsValidation(tableCustomizationView.SelectedCells))
     {
         Color groupColor = Generator.GetRandomColor();
         foreach (int i in tableCustomizationView.SelectedCells)
         {
             table.TableCellButtonList[i - 1].setBodyColor(groupColor);
             table.TableCellButtonList[i - 1].deselectCell();
             table.TableCellButtonList[i - 1].InsertMergedCells(tableCustomizationView.SelectedCells);
             TableCellButton.ChangeState(table.TableCellButtonList[i - 1]);
         }
         tableCustomizationView.SelectedCells.Clear();
     }
 }
Exemple #4
0
        public void SplitCells()
        {
            if (tableCustomizationView.SelectedCells.Count != 1)
            {
                tableCustomizationView.MultipleSplitErrorMessage();
            }
            else if ((table.TableCellButtonList[tableCustomizationView.SelectedCells[0] - 1].MergedCellsIndexes.Count == 0))
            {
                tableCustomizationView.MultipleSplitErrorMessage();
            }
            else
            {
                List <int> cellsToSplit = new List <int>(table.TableCellButtonList[tableCustomizationView.SelectedCells[0] - 1].MergedCellsIndexes);

                foreach (int i in cellsToSplit)
                {
                    table.TableCellButtonList[i - 1].setBodyColor(Control.DefaultBackColor);
                    table.TableCellButtonList[i - 1].MergedCellsIndexes.Clear();
                }
                table.TableCellButtonList[tableCustomizationView.SelectedCells[0] - 1].deselectCell();
                TableCellButton.ChangeState(table.TableCellButtonList[tableCustomizationView.SelectedCells[0] - 1]);
                tableCustomizationView.SelectedCells.Clear();
            }
        }
Exemple #5
0
 public void ControllsRemove(TableCellButton tableCellButton)
 {
     Controls.Remove(tableCellButton);
 }
Exemple #6
0
 public void ControllsAdd(TableCellButton tableCellButton)
 {
     Controls.Add(tableCellButton);
 }