Example #1
0
 /*
  * Этот класс должен расположить все элементы на экране:
  * 1. Поле для шахмат.
  * 2. Историю.
  * 3. Сообщения игрокам.
  */
 public ChessForm(ChessApp app, IBoardStyle boardStyle,
                  ICellBitmapSelector <ChessPiece> bitmapSelector, IMessageSelector <ChessGame> messageSelector)
 {
     this.app             = app;
     this.bitmapSelector  = bitmapSelector;
     this.messageSelector = messageSelector;
     board             = new BoardControl(boardStyle, bitmapSelector.BitmapWidth, bitmapSelector.BitmapHeight);
     board.CellClick  += app.ClickAt;
     app.StateChanged += Invalidate;
     // need some layout
 }
Example #2
0
        public static Bitmap[,] SelectAllBoard <TCell>(IChessBoard <TCell> board, ICellBitmapSelector <TCell> selector) // not here
        {
            var bitmaps = new Bitmap[board.RowCount, board.ColumnCount];

            for (int row = 0; row < board.RowCount; ++row)
            {
                for (int column = 0; column < board.ColumnCount; ++column)
                {
                    bitmaps[row, column] = selector.SelectBitmap(board[GetPosition(row, column, board.RowCount)]);
                }
            }
            return(bitmaps);
        }