コード例 #1
0
        public void change_Questions()
        {
            Button[] btn = { btnA, btnB, btnC, btnD };
            foreach (var i in btn)
            {
                i.BackColor = Color.LemonChiffon;
            }
            //string[] aq = new string[4];
            int count = questions.Count;
            int index = rand.Next(questions.Count);

            // ClassQuestions d = d.Answer;
            // if()
            //wrightWrong();
            if (count > 0)
            {//settinu up random values of Questions
                int getIndex = index;
                q = questions.ElementAt(getIndex);
                //setting up random values of Options
                //filling up Options
                //
                ClassQuestions cQ       = proxy.getQuestion(q);
                List <string>  opt      = proxy.getOptions(q);
                string         quetions = cQ.Question;

                txtQuestions.Text = quetions;
                btnA.Text         = opt.ElementAt(0);
                btnB.Text         = opt.ElementAt(1);
                btnC.Text         = opt.ElementAt(2);
                btnD.Text         = opt.ElementAt(3);
                questions.RemoveAt(getIndex);
            }
            else
            {
                MessageBox.Show("Game Completed", "Congrats", MessageBoxButtons.OK);
                this.Hide();
                var score = new Scores();
                score.Closed += (s, args) => this.Close();
                score.Show();
            }
        }
コード例 #2
0
        private void btnHighScore_Click(object sender, EventArgs e)
        {
            Scores sc = new Scores();

            sc.ShowDialog();
        }