コード例 #1
0
        //Purpose: When Clicked it set the names for the three players
        //and will check to see if all three boxes have names in them
        //Requires: Nothing
        //Returns: Nothing
        private void Set_Name_Click(object sender, EventArgs e)
        {
            {
                Playeronename.Clear();
                playertwoname.Clear();
                Playerthreename.Clear();

                //Conditional Statement to check and see if the enter three names into the text box
                if (Player1_textBox.Text == "" || playertwo_TextBox.Text == "" ||
                    Playerthree_textBox.Text == "")
                {
                    MessageBox.Show("Must enter a name for all Players",
                                    "Missing a Name or Names!", MessageBoxButtons.OK);
                }
                else
                {
                    p1.pName = Player1_textBox.Text;    //sets name for player one
                    Playeronename.AppendText(p1.pName); //outputs name for player one


                    p2.pName = playertwo_TextBox.Text;  //sets name for player two
                    playertwoname.AppendText(p2.pName); //outputs name for player two


                    p3.pName = Playerthree_textBox.Text;  //sets name for player three
                    Playerthreename.AppendText(p3.pName); //outputs name for player three

                    //Hides Boxes and labels that are no longer needed
                    Set_Name.Hide();
                    Player1_textBox.Hide();
                    playertwo_TextBox.Hide();
                    Playerthree_textBox.Hide();
                    Playerthree_label.Hide();
                    Playertwo_Label.Hide();
                    Playerone_Label.Hide();
                    rounds(); //calls the round function to begin round one
                }
            }
        }
コード例 #2
0
        //Below are the various functions used that are implemented in
        //the buttons listed above.

        //Purpose: To Hide all Components that are not
        //needed at the begining of the game
        //Requires:Nothing
        //Returns;Nothing
        private void hideComponents()
        {
            Question_Box.Hide();
            Boarder_Box.Hide();
            Answers_Textbox.Hide();
            Answer_Button.Hide();
            Start_Button.Hide();
            Next_Question_Button.Hide();
            SpinButton.Hide();
            Begin_Spin_Round.Hide();
            Spin_Round_Instruction.Hide();
            Set_Name.Hide();
            Player1_textBox.Hide();
            playertwo_TextBox.Hide();
            Playerthree_textBox.Hide();
            Playerthree_label.Hide();
            Playertwo_Label.Hide();
            Playerone_Label.Hide();
            Yes_Button.Hide();
            No_Button.Hide();
            Next_Round_button.Hide();
            Quit_Button.Hide();
        }