public MultipleChoicePanel(CustomFonts customFonts) : base()
        {
            this.Size = new Size(450, 50);

            exampleRadioButton          = new RadioButton();
            exampleRadioButton.Font     = customFonts.TextBoxFont();
            exampleRadioButton.Size     = new Size(15, 28);
            exampleRadioButton.Location = new Point(0, 11);
            this.Controls.Add(exampleRadioButton);

            exampleLabel             = new Label();
            exampleLabel.MaximumSize = new Size(390, 0);
            exampleLabel.Location    = new Point(15, 0);
            exampleLabel.AutoSize    = true;
            exampleLabel.Font        = customFonts.TextBoxFont();
            exampleLabel.Visible     = false;
            this.Controls.Add(exampleLabel);
            exampleLabel.Click += exampleLabel_Click_1;

            exampleTextBox            = new TextBox();
            exampleTextBox.Font       = customFonts.TextBoxFont();
            exampleTextBox.Size       = new Size(390, 50);
            exampleTextBox.Location   = new Point(15, 0);
            exampleTextBox.Multiline  = true;
            exampleTextBox.ScrollBars = ScrollBars.Vertical;
            this.Controls.Add(exampleTextBox);
            exampleTextBox.BringToFront();
            exampleTextBox.LostFocus += exampleTextBox_LostFocus_1;

            deleteButton          = new QuestionDeleteButton(customFonts);
            deleteButton.Location = new Point(410, 11);
            this.Controls.Add(DeleteButton);
        }
        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 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);
        }
Example #5
0
        public SubQuestionPanel(CustomFonts customFonts) : base()
        {
            questionTextBox            = new TextBox();
            questionTextBox.Multiline  = true;
            questionTextBox.ScrollBars = ScrollBars.Vertical;
            questionTextBox.Font       = customFonts.TextBoxFont();
            this.Controls.Add(questionTextBox);

            questionLabel          = new Label();
            questionLabel.AutoSize = true;
            questionLabel.Visible  = false;
            questionLabel.Font     = customFonts.TextBoxFont();
            this.Controls.Add(questionLabel);

            examScorePanel = new ScorePanel(customFonts);
            this.Controls.Add(examScorePanel);

            deleteButton = new QuestionDeleteButton(customFonts);
            this.Controls.Add(deleteButton);
        }