private void deleteButton_Click_1(object sender, EventArgs e) { QuestionDeleteButton deleteButton = (QuestionDeleteButton)sender; MultipleChoicePanel choicePanel = (MultipleChoicePanel)deleteButton.Parent; int index = choicePanelList.IndexOf(choicePanel); int count = choicePanelList.Count; for (int i = count - 1; i > index; i--) { choicePanelList[i].Location = choicePanelList[i - 1].Location; } this.Controls.Remove(choicePanel); choicePanelList.RemoveAt(index); moveListItems(index); count = choicePanelList.Count; if (count == 0) { this.Height = 300; } else { this.Height = choicePanelList[count - 1].Location.Y + choicePanelList[count - 1].Height + 20; } ExamScorePanel.Location = new Point(520, (this.Height - ExamScorePanel.Height) / 2); DeleteButton.Location = new Point(605, (this.Height - DeleteButton.Height) / 2); }
private void exampleLabel_Click_2(object sender, EventArgs e) { Label exampleLabel = (Label)sender; MultipleChoicePanel choicePanel = (MultipleChoicePanel)exampleLabel.Parent; int index = choicePanelList.IndexOf(choicePanel); moveListItems(index + 1); }
private void exampleTextBox_LostFocus_2(object sender, EventArgs e) { TextBox exampleTextBox = (TextBox)sender; MultipleChoicePanel choicePanel = (MultipleChoicePanel)exampleTextBox.Parent; int index = choicePanelList.IndexOf(choicePanel); moveListItems(index + 1); }
private void exampleRadioButton_Click_1(object sender, EventArgs e) { int count = choicePanelList.Count; RadioButton exampRadioButton = (RadioButton)sender; MultipleChoicePanel choicePanel = (MultipleChoicePanel)exampRadioButton.Parent; for (int i = 0; i < count; i++) { if (choicePanelList[i] != choicePanel) { choicePanelList[i].ExampleRadioButton.Checked = false; } } answer = choicePanelList.IndexOf(choicePanel); }
private void addButton_Click_1(object sender, EventArgs e) { MultipleChoicePanel choicePanel = new MultipleChoicePanel(customFonts); int count = choicePanelList.Count; if (count == 0) { choicePanel.Location = new Point(50, addButton.Location.Y + addButton.Height + 10); } else { choicePanel.Location = new Point(50, choicePanelList[count - 1].Location.Y + choicePanelList[count - 1].Height + 5); } this.Controls.Add(choicePanel); choicePanelList.Add(choicePanel); choicePanel.ExampleLabel.Click += exampleLabel_Click_2; choicePanel.ExampleTextBox.LostFocus += exampleTextBox_LostFocus_2; choicePanel.DeleteButton.Click += deleteButton_Click_1; choicePanel.ExampleRadioButton.Click += exampleRadioButton_Click_1; this.Height = choicePanelList[count].Location.Y + choicePanelList[count].Height + 20; ExamScorePanel.Location = new Point(520, (this.Height - ExamScorePanel.Height) / 2); DeleteButton.Location = new Point(605, (this.Height - DeleteButton.Height) / 2); }