private void subQuestionDeleteButton_Click_1(object sender, EventArgs e) { int count; int idx; QuestionDeleteButton deleteButton = (QuestionDeleteButton)sender; SubQuestionPanel subQuestionPanel = (SubQuestionPanel)deleteButton.Parent; count = subQuestionPanelsList.Count; idx = subQuestionPanelsList.IndexOf(subQuestionPanel); for (int i = count - 1; i > idx; i--) { subQuestionPanelsList[i].Location = subQuestionPanelsList[i - 1].Location; } subQuestionPanelsList.RemoveAt(idx); this.Controls.Remove(subQuestionPanel); moveListItems(idx); count = subQuestionPanelsList.Count; if (count == 0) { questionKindPanel.QuestionKindComboBox.Enabled = true; this.Height = 500; } else { this.Height = subQuestionPanelsList[count - 1].Location.Y + subQuestionPanelsList[count - 1].Height + 20; } totalScorePanel.ScoreTextBox.Text = (int.Parse(totalScorePanel.ScoreTextBox.Text) - int.Parse(subQuestionPanel.ExamScorePanel.ScoreTextBox.Text)).ToString(); }
private void subQuestion_deleteExampleButton_Click_1(object sender, EventArgs e) { QuestionDeleteButton deleteButton = (QuestionDeleteButton)sender; SubQuestionPanel subQuestionPanel = (SubQuestionPanel)deleteButton.Parent.Parent; int idx = subQuestionPanelsList.IndexOf(subQuestionPanel); moveListItems(idx + 1); }
private void subQuestion_essayAnswerTextBox_LostFocus_1(object sender, EventArgs e) { TextBox textBox = (TextBox)sender; int idx; SubQuestionPanel subQuestionPanel = (SubQuestionPanel)textBox.Parent.Parent; idx = subQuestionPanelsList.IndexOf(subQuestionPanel); moveListItems(idx + 1); }
private void subQuestion_essayAnswerLabel_Click_1(object sender, EventArgs e) { Label label = (Label)sender; int idx; SubQuestionPanel subQuestionPanel = (SubQuestionPanel)label.Parent.Parent; idx = subQuestionPanelsList.IndexOf(subQuestionPanel); moveListItems(idx + 1); }
private void subQuestion_addExampleButton_Click_1(object sender, EventArgs e) { Panel parentPanel = (Panel)this.Parent; AddExampleButton addExampleButton = (AddExampleButton)sender; SubQuestionPanel subQuestionPanel = (SubQuestionPanel)addExampleButton.Parent; MultipleChoiceQuestionPanel multipleChoiceQuestionPanel = (MultipleChoiceQuestionPanel)addExampleButton.Parent; multipleChoiceQuestionPanel.ChoicePaneList[multipleChoiceQuestionPanel.ChoicePaneList.Count - 1].DeleteButton.Click += subQuestion_deleteExampleButton_Click_1; int idx = subQuestionPanelsList.IndexOf(subQuestionPanel); moveListItems(idx + 1); parentPanel.AutoScrollPosition = new Point(0, parentPanel.Height); multipleChoiceQuestionPanel.ChoicePaneList[multipleChoiceQuestionPanel.ChoicePaneList.Count - 1].ExampleTextBox.Focus(); }