コード例 #1
0
        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();
        }
コード例 #2
0
        private void addSubQuestionButton_Click_1(object sender, EventArgs e)
        {
            int   index       = questionKindPanel.QuestionKindComboBox.SelectedIndex;
            int   count       = subQuestionPanelsList.Count;
            Panel parentPanel = (Panel)this.Parent;

            if (index == 0)
            {
                OXPanel oxPanel = new OXPanel(customFonts);
                this.Controls.Add(oxPanel);
                subQuestionPanelsList.Add(oxPanel);
            }
            else if (index == 1)
            {
                ShortAnswerQuestionPanel shortAnswerQuestionPanel = new ShortAnswerQuestionPanel(customFonts);
                this.Controls.Add(shortAnswerQuestionPanel);
                subQuestionPanelsList.Add(shortAnswerQuestionPanel);
            }
            else if (index == 2)
            {
                EssayQuestionPanel essayQuestionPanel = new EssayQuestionPanel(customFonts);
                this.Controls.Add(essayQuestionPanel);
                subQuestionPanelsList.Add(essayQuestionPanel);
                essayQuestionPanel.AnswerPanel.AnswerTextBox.LostFocus += subQuestion_essayAnswerTextBox_LostFocus_1;
                essayQuestionPanel.AnswerPanel.AnswerLabel.Click       += subQuestion_essayAnswerLabel_Click_1;
            }
            else if (index == 3)
            {
                MultipleChoiceQuestionPanel multipleChoiceQuestionPanel = new MultipleChoiceQuestionPanel(customFonts);
                this.Controls.Add(multipleChoiceQuestionPanel);
                subQuestionPanelsList.Add(multipleChoiceQuestionPanel);
                multipleChoiceQuestionPanel.AddButton.Click += subQuestion_addExampleButton_Click_1;
            }
            else
            {
                return;
            }

            if (count == 0)
            {
                if (mainQuestionTextBox.Visible)
                {
                    subQuestionPanelsList[count].Location = new Point(100, mainQuestionTextBox.Location.Y + mainQuestionTextBox.Height + 50);
                }
                else
                {
                    subQuestionPanelsList[count].Location = new Point(100, mainQuestionLabel.Location.Y + mainQuestionLabel.Height + 50);
                }
            }
            else
            {
                subQuestionPanelsList[count].Location = new Point(100, subQuestionPanelsList[count - 1].Location.Y + subQuestionPanelsList[count - 1].Height + 20);
            }
            subQuestionPanelsList[count].DeleteButton.Click        += subQuestionDeleteButton_Click_1;
            subQuestionPanelsList[count].QuestionLabel.Click       += subQuestionLabel_Click_1;
            subQuestionPanelsList[count].QuestionTextBox.LostFocus += subQuestionTextBox_LostFocus_1;
            subQuestionPanelsList[count].Click += Click_1;
            subQuestionPanelsList[count].ExamScorePanel.ScoreTextBox.TextChanged += scoreTextBox_TextChanged;
            subQuestionPanelsList[count].QuestionTextBox.Focus();
            totalScorePanel.ScoreTextBox.Text = (int.Parse(totalScorePanel.ScoreTextBox.Text) + 10).ToString();
            questionKindPanel.QuestionKindComboBox.Enabled = false;
            this.Height = subQuestionPanelsList[count].Location.Y + subQuestionPanelsList[count].Height + 20;
            parentPanel.AutoScrollPosition = new Point(0, parentPanel.Height);
        }