public CellAdressableCell JoinCell(CellJoinDirection direction) { CellCoordinate myCoord = parentTable.FindCell(this); CellAdressableCell otherCell = null; try { switch (direction) { case CellJoinDirection.DOWN: otherCell = parentTable[myCoord.row + 1, myCoord.column]; if (this.Cell.RowSpan < 2) { this.Cell.RowSpan = 2; } else { this.Cell.RowSpan++; } break; case CellJoinDirection.LEFT: otherCell = parentTable[myCoord.row, myCoord.column - 1]; if (otherCell.Cell.ColSpan < 2) { otherCell.Cell.ColSpan = 2; } else { otherCell.Cell.ColSpan++; } break; case CellJoinDirection.RIGHT: otherCell = parentTable[myCoord.row, myCoord.column + 1]; if (this.Cell.ColSpan < 2) { this.Cell.ColSpan = 2; } else { this.Cell.ColSpan++; } break; case CellJoinDirection.UP: otherCell = parentTable[myCoord.row - 1, myCoord.column]; if (otherCell.Cell.RowSpan < 2) { otherCell.Cell.RowSpan = 2; } else { otherCell.Cell.RowSpan++; } break; } } catch (Exception e) { throw new Exception("Cant Join Cell in that direction.", e); } return(otherCell); }
public CellAdressableCell JoinCell (CellJoinDirection direction) { CellCoordinate myCoord = parentTable.FindCell(this); CellAdressableCell otherCell = null; try { switch (direction) { case CellJoinDirection.DOWN: otherCell = parentTable[myCoord.row + 1, myCoord.column]; if (this.Cell.RowSpan < 2) this.Cell.RowSpan = 2; else this.Cell.RowSpan++; break; case CellJoinDirection.LEFT: otherCell = parentTable[myCoord.row, myCoord.column - 1]; if (otherCell.Cell.ColSpan < 2) otherCell.Cell.ColSpan = 2; else otherCell.Cell.ColSpan++; break; case CellJoinDirection.RIGHT: otherCell = parentTable[myCoord.row, myCoord.column + 1]; if (this.Cell.ColSpan < 2) this.Cell.ColSpan = 2; else this.Cell.ColSpan++; break; case CellJoinDirection.UP: otherCell = parentTable[myCoord.row - 1, myCoord.column]; if (otherCell.Cell.RowSpan < 2) otherCell.Cell.RowSpan = 2; else otherCell.Cell.RowSpan++; break; } } catch (Exception e) { throw new Exception("Cant Join Cell in that direction.", e); } return otherCell; }