Пример #1
0
        private void pnlBoard_MouseUp(object sender, MouseEventArgs e)
        {
            // do we know where we dropped?
            if (_lastSquareMousedOverCol != null && _lastSquareMousedOverRow != null)
            {
                // do we know where we started?
                if (_squareBeginDragCol != null && _squareBeginDragRow != null)
                {
                    ChessSquare startingSquare = _board.Squares[_squareBeginDragCol.Value, _squareBeginDragRow.Value];
                    ChessSquare dropSquare     = _board.Squares[_lastSquareMousedOverCol.Value, _lastSquareMousedOverRow.Value];
                    if (_board.AttemptMove(startingSquare, dropSquare))
                    {
                    }
                }
            }

            _squareBeginDragCol  = null;
            _squareBeginDragRow  = null;
            _currentPieceANMoves = new string[0];
            pnlBoard.Invalidate();
        }