示例#1
0
        private void SetUpBoard()
        {
            ChessSquare chessSquare;
            bool        grey = false;

            for (int column = 0; column < 8; column++)
            {
                for (int row = 0; row < 8; row++)
                {
                    chessSquare = new ChessSquare(grey);
                    chessSquare.SetValue(Grid.ColumnProperty, column);
                    chessSquare.SetValue(Grid.RowProperty, row);


                    chessSquare.SetPicture(board[column, row]?.BitmapImage);

                    ChessBoard.Children.Add(chessSquare);
                    grey = !grey;
                }
                grey = !grey;
            }
        }
示例#2
0
        private void SetUpBoard()
        {
            ChessSquare chessSquare;

            bool grey = false;

            for (int column = 0; column < 8; column++)
            {
                for (int row = 0; row < 8; row++)
                {
                    chessSquare = new ChessSquare(grey);
                    chessSquare.SetValue(Grid.ColumnProperty, column);
                    chessSquare.SetValue(Grid.RowProperty, row);
                    chessSquare.MouseDown += ChessBoard_MouseDown;
                    chessSquare.SetPicture(board.GetSpace(column, row));

                    chessSquareBoard[row, column] = chessSquare;

                    ChessBoard.Children.Add(chessSquare);
                    grey = !grey;
                }
                grey = !grey;
            }
        }