예제 #1
0
        public SquareButton CreateButton(string text, int playerTurn, int xPos, int yPos)
        {
            var btn = new SquareButton();

            btn.Width   = _squareSize;
            btn.Height  = _squareSize;
            btn.Content = text;
            btn.X       = xPos;
            btn.Y       = yPos;
            btn.Player  = playerTurn;
            btn.Name    = "btn";

            switch (playerTurn)
            {
            case 1:
                btn.Background = Brushes.RoyalBlue;
                break;

            case 2:
                btn.Background = Brushes.Red;
                break;

            default:
                btn.Background = Brushes.White;
                btn.Click     += BtnClick;
                break;
            }

            return(btn);
        }
예제 #2
0
        public SquareButton CreateButton(string text, int playerTurn, int xPos, int yPos)
        {
            var btn = new SquareButton();
            btn.Width = _squareSize;
            btn.Height = _squareSize;
            btn.Content = text;
            btn.X = xPos;
            btn.Y = yPos;
            btn.Player = playerTurn;
            btn.Name = "btn";

            switch (playerTurn)
            {
                case 1:
                    btn.Background = Brushes.RoyalBlue;
                    break;
                case 2:
                    btn.Background = Brushes.Red;
                    break;

                default:
                    btn.Background = Brushes.White;
                    btn.Click += BtnClick;
                    break;
            }

            return btn;
        }