private void exampleRadioButton_Click_1(object sender, EventArgs e) { int count = choicePanelList.Count; RadioButton exampRadioButton = (RadioButton)sender; ExamMultipleChoicePanel choicePanel = (ExamMultipleChoicePanel)exampRadioButton.Parent; for (int i = 0; i < count; i++) { if (choicePanelList[i] != choicePanel) { choicePanelList[i].ExampleRadioButton.Checked = false; } } answer = choicePanelList.IndexOf(choicePanel); }
private void setMultipleQuestions(string[] multipleQuestions) { int length = multipleQuestions.Length; for (int i = 0; i < length; i++) { ExamMultipleChoicePanel choicePanel = new ExamMultipleChoicePanel(customFonts, multipleQuestions[i]); if (i == 0) { choicePanel.Location = new Point(50, QuestionLabel.Location.Y + QuestionLabel.Height + 30); } else { choicePanel.Location = new Point(50, choicePanelList[i - 1].Location.Y + choicePanelList[i - 1].Height + 5); } this.Controls.Add(choicePanel); choicePanelList.Add(choicePanel); if (isStudent) { choicePanel.ExampleRadioButton.Click += exampleRadioButton_Click_1; } } }