Пример #1
0
 void TableAnswerMultiTeam_1(List<Question> ListQuestion, List<Answer> ListAnswer)
 {
     int a = 65;
     int No = 0;
     int D = 0;
     foreach (Team teamCS in flp_Team.Controls)
     {
         teamCS.chk_Challenged.Visible = false;
         if (teamCS.chk_Challenged.Checked == true)
         {
             D++;
         }
     }
     int D1 = D - 1;
     /////show answer one on control screen
     foreach (Team teamCS in flp_Team.Controls)
     {
         teamCS.chk_Challenged.Visible = false;
         if (teamCS.chk_Challenged.Checked == true)
         {
             PlayerAnswer PlayerAnswer = new PlayerAnswer();
             PlayerAnswer.pb_Result.BackColor = Color.FromArgb(colorplayer(Convert.ToInt32(teamCS.lbl_IDPlayer.Text)));
             PlayerAnswer.lbl_IDPlayer.Text = teamCS.lbl_IDPlayer.Text;
             PlayerAnswer.lbl_TeamName.Text = teamCS.lbl_TeamName.Text;
             PlayerAnswer.Location = new Point(PlayerAnswer.Location.X + (audience.flp_PlayerAnswers.Width / (D) / 2 - PlayerAnswer.Width / 2) + audience.flp_PlayerAnswers.Width / D * No, PlayerAnswer.Location.Y + 5);
             audience.flp_PlayerAnswers.Controls.Add(PlayerAnswer);
             No++;
             D1--;
             if (ListQuestion.ElementAt(0).TypeQuestion.ToLower() == "onechoice")
             {
                 for (int h = 0; h < ListAnswer.Count; h++)
                 {
                     RadioButton radioButton = new RadioButton();
                     radioButton.ForeColor = Color.White;
                     radioButton.Text = Convert.ToChar(a + h).ToString();
                     radioButton.AutoSize = true;
                     teamCS.flp_Answer.Controls.Add(radioButton);
                 }
             }
             else
             {
                 if (ListQuestion.ElementAt(0).TypeQuestion.ToLower() == "multichoice")
                 {
                     for (int h = 0; h < ListAnswer.Count; h++)
                     {
                         CheckBox checkBox = new CheckBox();
                         checkBox.ForeColor = Color.White;
                         checkBox.Text = Convert.ToChar(a + h).ToString();
                         checkBox.AutoSize = true;
                         teamCS.flp_Answer.Controls.Add(checkBox);
                     }
                 }
                 else
                 {
                     TextBox textBox = new TextBox();
                     textBox.ForeColor = Color.Black;
                     textBox.AutoSize = false;
                     textBox.Anchor = AnchorStyles.Top;
                     textBox.Anchor = AnchorStyles.Left;
                     textBox.Location = new Point(textBox.Location.X + 0, textBox.Location.Y + 0);
                     textBox.Size = new System.Drawing.Size(teamCS.flp_Answer.Width - 7, teamCS.flp_Answer.Height - 7);
                     textBox.Font = new Font("Verdana", 12.0f, FontStyle.Bold);
                     teamCS.flp_Answer.Controls.Add(textBox);
                 }
             }
         }
     }
 }
Пример #2
0
        //Show table answer for one player. When Not Challenge
        void TableAnswerOneTeam(List<Question> ListQuestion, List<Answer> ListAnswer)
        {
            int a = 65;

            /////show answer one on control screen
            foreach (Team teamCS in flp_Team.Controls)
            {
                //show table answer
                if (Convert.ToInt32(teamCS.lbl_Sequence.Text) == sequenceplayer(records.ElementAt(team).IDPlayer))
                {
                    //dislay team will answer question
                    PlayerAnswer PlayerAnswer = new PlayerAnswer();
                    PlayerAnswer.pb_Result.BackColor = Color.FromArgb(colorplayer(Convert.ToInt32(teamCS.lbl_IDPlayer.Text)));
                    PlayerAnswer.lbl_IDPlayer.Text = teamCS.lbl_IDPlayer.Text;
                    PlayerAnswer.lbl_TeamName.Text = teamCS.lbl_TeamName.Text;
                    PlayerAnswer.Location = new Point(PlayerAnswer.Location.X + (audience.flp_PlayerAnswers.Width / 2 - PlayerAnswer.Width / 2), PlayerAnswer.Location.Y + 5);
                    audience.flp_PlayerAnswers.Controls.Add(PlayerAnswer);

                    if (ListQuestion.ElementAt(0).TypeQuestion.ToLower() == "onechoice")
                    {
                        for (int h = 0; h < ListAnswer.Count; h++)
                        {
                            RadioButton radioButton = new RadioButton();
                            radioButton.ForeColor = Color.White;
                            radioButton.Text = Convert.ToChar(a + h).ToString();
                            radioButton.AutoSize = true;
                            teamCS.flp_Answer.Controls.Add(radioButton);
                        }
                    }
                    else
                    {
                        if (ListQuestion.ElementAt(0).TypeQuestion.ToLower() == "multichoice")
                        {
                            for (int h = 0; h < ListAnswer.Count; h++)
                            {
                                CheckBox checkBox = new CheckBox();
                                checkBox.ForeColor = Color.White;
                                checkBox.Text = Convert.ToChar(a + h).ToString();
                                checkBox.AutoSize = true;
                                teamCS.flp_Answer.Controls.Add(checkBox);
                            }
                        }
                        else
                        {
                            TextBox textBox = new TextBox();
                            textBox.ForeColor = Color.Black;
                            textBox.AutoSize = false;
                            textBox.Anchor = AnchorStyles.Top;
                            textBox.Anchor = AnchorStyles.Left;
                            textBox.Location = new Point(textBox.Location.X + 0, textBox.Location.Y + 0);
                            textBox.Size = new System.Drawing.Size(teamCS.flp_Answer.Width - 7, teamCS.flp_Answer.Height - 7);
                            textBox.Font = new Font("Verdana", 12.0f, FontStyle.Bold);
                            teamCS.flp_Answer.Controls.Add(textBox);
                        }
                    }
                }
            }
        }
Пример #3
0
        private void PreviewQuestion_Load(object sender, EventArgs e)
        {
            lbl_QuestionContent.Text = questionPreview;
            if (answerPreview.Count == 2)
            {
                for (int i = 0; i < answerPreview.Count; i++)
                {
                    ShowAnswer showanswer = new ShowAnswer();
                    showanswer.rtxt_Answer.Text = answerPreview.ElementAt(i).ToString();
                    showanswer.Size = new System.Drawing.Size(flp_AnswerQuiz.Width / 2 - 10, flp_AnswerQuiz.Height / (int)(Math.Ceiling((double)answerPreview.Count)) - 10);
                    showanswer.lbl_labelAnswer.Text = Convert.ToChar(65 + i).ToString() + ".";
                    flp_AnswerQuiz.Controls.Add(showanswer);
                }
            }
            else
            {
                for (int i = 0; i < answerPreview.Count; i++)
                {
                    ShowAnswer showanswer = new ShowAnswer();
                    showanswer.rtxt_Answer.Text = answerPreview.ElementAt(i).ToString();
                    showanswer.Size = new System.Drawing.Size(flp_AnswerQuiz.Width / 2 - 10, flp_AnswerQuiz.Height / (int)(Math.Ceiling((double)answerPreview.Count / 2)) - 10);
                    showanswer.lbl_labelAnswer.Text = Convert.ToChar(65 + i).ToString() + ".";
                    flp_AnswerQuiz.Controls.Add(showanswer);
                }
            }

            PlayerAnswer PlayerAnswer = new PlayerAnswer();
            PlayerAnswer.lbl_TeamName.Text = "GSC Team";
            PlayerAnswer.lbl_TeamAnswer.Text = "A";
            PlayerAnswer.lbl_Score.Text = "+20";
            PlayerAnswer.lbl_Score.Visible = true;
            PlayerAnswer.Location = new Point(PlayerAnswer.Location.X + flp_PlayerAnswers.Width/2 - PlayerAnswer.Width/2,PlayerAnswer.Location.Y+0);
            flp_PlayerAnswers.Controls.Add(PlayerAnswer);

            FixSizeText();
        }