Пример #1
0
        private void ChangeElementCellValue(SumCell cell, int value)
        {
            Point valueLocation = new Point(UpperLeftLocation(cell.x, cell.y).X + 6,
                                            UpperLeftLocation(cell.x, cell.y).Y + 3);
            Font font = new Font("Constantia", 20);

            graphics.DrawString(value.ToString(), font, Brushes.Black, valueLocation);
        }
Пример #2
0
 public CellGroup(SumCell sumCell, List <OpenCell> cellList, DebugLog debugLog)
 {
     this.debugLog = debugLog;
     this.sumCell  = sumCell;
     data          = new GroupData(cellList);
     foreach (OpenCell cell in data.cellList)
     {
         cell.AddParentGroup(this);
     }
 }
Пример #3
0
 public void CreateBlackCells()
 {
     for (int y = 0; y < constants.dimensions; ++y)
     {
         for (int x = 0; x < constants.dimensions; ++x)
         {
             if (cellMatrix[x, y] == null)
             {
                 cellMatrix[x, y] = new SumCell(x, y);
             }
         }
     }
 }
Пример #4
0
        private void CreateARowGroup(Coordinates coordinates)
        {
            Queue <OpenCell> cellQueue  = new Queue <OpenCell>();
            SumCell          rowSumCell = (SumCell)cellMatrix[coordinates.X - 1, coordinates.Y];

            while ((coordinates.X < constants.dimensions) && CellIsOpen(coordinates))
            {
                OpenCell cellToAdd = (OpenCell)cellMatrix[coordinates.X, coordinates.Y];
                cellQueue.Enqueue(cellToAdd);
                coordinates = new Coordinates(coordinates.X + 1, coordinates.Y);
            }
            CellGroup newGroup = new RowCellGroup(rowSumCell, new List <OpenCell>(cellQueue), debugLog);

            CellGroup.rowList.Add(newGroup);
            cellGroupsWithoutSums.Push(newGroup);
        }
Пример #5
0
        public void DrawSumsCell(SumCell cell, int rowTotal, int columnTotal)
        {
            Point upperLeftPoint  = UpperLeftLocation(cell.x, cell.y);
            Point lowerRightPoint = LowerRightLocation(cell.x, cell.y);
            Point upperRightPoint = UpperRightLocation(cell.x, cell.y);
            Point lowerLeftPoint  = LowerLeftLocation(cell.x, cell.y);

            Point columnTotalLocation = new Point(upperLeftPoint.X + 5, upperLeftPoint.Y + 22);
            Point rowTotalLocation    = new Point(upperLeftPoint.X + 19, upperLeftPoint.Y + 3);
            Font  font = new Font("Biondi", 9);

            Point[] upperRightTriangle = { upperLeftPoint, upperRightPoint, lowerRightPoint };
            Point[] lowerLeftTriangle  = { upperLeftPoint, lowerLeftPoint, lowerRightPoint };
            if (columnTotal != 0)
            {
                if (rowTotal == 0)
                {
                    graphics.FillPolygon(Brushes.Black, upperRightTriangle);
                }
                graphics.FillPolygon(Brushes.LightGray, lowerLeftTriangle);
                graphics.DrawPolygon(Pens.AntiqueWhite, upperRightTriangle);
                graphics.DrawPolygon(Pens.Black, lowerLeftTriangle);
                graphics.DrawString(columnTotal.ToString(), font, Brushes.Black, columnTotalLocation);
            }
            if (rowTotal != 0)
            {
                if (columnTotal == 0)
                {
                    graphics.FillPolygon(Brushes.Black, lowerLeftTriangle);
                }
                graphics.FillPolygon(Brushes.LightGray, upperRightTriangle);
                graphics.DrawPolygon(Pens.AntiqueWhite, lowerLeftTriangle);
                graphics.DrawPolygon(Pens.Black, upperRightTriangle);
                graphics.DrawString(rowTotal.ToString(), font, Brushes.Black, rowTotalLocation);
            }
            Pen linePen = new Pen(Brushes.Black, 2);

            graphics.DrawLine(linePen, upperLeftPoint, lowerRightPoint);
        }
Пример #6
0
        private Rectangle GetRectangle(SumCell blackCell)
        {
            Size size = new Size(constants.cellWidth, constants.cellWidth);

            return(new Rectangle(UpperLeftLocation(blackCell.x, blackCell.y), size));
        }
Пример #7
0
 public void DrawBlackBox(SumCell cell)
 {
     graphics.FillRectangle(Brushes.Black, GetRectangle(cell));
     graphics.DrawRectangle(Pens.LightGray, GetRectangle(cell));
 }
Пример #8
0
 public RowCellGroup(SumCell sumCell, List <OpenCell> cellList, DebugLog log)
     : base(sumCell, cellList, log)
 {
 }