public MultipleChoiceQuestionPanel(CustomFonts customFonts) : base(customFonts) { this.customFonts = customFonts; this.Size = new Size(645, 160); answer = -1; Type = 3; addButton = new AddExampleButton(customFonts); addButton.Location = new Point(420, 110); this.Controls.Add(addButton); addButton.Click += addButton_Click_1; choicePanelList = new List <MultipleChoicePanel>(); QuestionTextBox.Size = new System.Drawing.Size(500, 100); QuestionTextBox.LostFocus += questionTextBox_LostFocus_1; QuestionLabel.MaximumSize = new System.Drawing.Size(500, 0); QuestionLabel.Location = new Point(0, 10); QuestionLabel.Click += questionLabel_Click_1; ExamScorePanel.Location = new Point(520, (this.Height - ExamScorePanel.Height) / 2); DeleteButton.Location = new Point(605, (this.Height - DeleteButton.Height) / 2); }
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(); }