void TableAnswerMultiTeam(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 (Convert.ToInt32(teamCS.lbl_Sequence.Text) == sequenceplayer(records.ElementAt(team).IDPlayer) || 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 (Convert.ToInt32(teamCS.lbl_Sequence.Text) == sequenceplayer(records.ElementAt(team).IDPlayer) || 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);
}
}
}
}
foreach (PlayerAnswer playerAnswer in audience.flp_PlayerAnswers.Controls)
{
//show notify to know challenged team
if (Convert.ToInt32(playerAnswer.lbl_IDPlayer.Text) == records.ElementAt(team).IDPlayer)
{
playerAnswer.lbl_TeamName.BackColor = Color.LightSeaGreen;
}
}
}