private void PaintTile(CellWrapper tile, Graphics g, int x, int y) { int tileData = tile.GetData(); if ((tileData & (int)CellValue.HasCell) == 0) { // No cel, return. return; } Point paintPos = CellToPixel(x, y); g.FillRectangle(_tileBackColor, paintPos.X, paintPos.Y, ScaledCellSize, ScaledCellSize); if ((tileData & (int)CellValue.IsEmpty) == 0) { Brush brush; if ((tileData & (int)CellValue.IsMax) != 0) { brush = _pieceMaxColor; } else { brush = _pieceMinColor; } g.FillEllipse( brush, paintPos.X + (ScaledCellSize - ScaledPieceSize) / 2, paintPos.Y + (ScaledCellSize - ScaledPieceSize) / 2, ScaledPieceSize, ScaledPieceSize ); if ((tileData & (int)CellValue.IsFlipped) != 0) { g.DrawEllipse( _pieceAccentColor, paintPos.X + (ScaledCellSize - ScaledAccentSize) / 2, paintPos.Y + (ScaledCellSize - ScaledAccentSize) / 2, ScaledAccentSize, ScaledAccentSize ); } } }