예제 #1
0
        void AddPanel(QPanel panel)
        {
            panel.Top = ((QuestionPanel.Controls.Count != 0) ? QuestionPanel.Controls[QuestionPanel.Controls.Count - 1].Bottom : 0) + 6;

            if (QuestionPanel.Controls.Count == 0)
            {
                panel.Width = QuestionPanel.Width - 12;
            }
            else
            {
                panel.Width = QuestionPanel.Controls[0].Width;
            }

            QuestionPanel.Controls.Add(panel);
        }
예제 #2
0
        internal void AddQuestion(Question q = null, bool scrollToEnd = false)
        {
            SetNativeEnabled(false);

            var questionEditor = new QuestionEditor(q, s => !questions.Any(x => x.question == s));

            questionEditor.FormClosing += (s, e) =>
            {
                SetNativeEnabled(true);
                Focus();

                if (questionEditor.DialogResult == DialogResult.OK)
                {
                    changes = true;

                    Question question = questionEditor.GetQuestion();
                    questions.Add(question);

                    var questionPanel = new QPanel(QuestionPanel, question, QuestionPanel.Controls.Count);

                    AddPanel(questionPanel);

                    if (scrollToEnd)
                    {
                        QuestionPanel.VerticalScroll.Value = 0;
                        QuestionPanel.ScrollControlIntoView(questionPanel);
                    }

                    RefreshOK();

                    foreach (var control in QuestionPanel.Controls)
                    {
                        QPanel qPanel = control as QPanel;

                        qPanel.ID = qPanel.ID;
                    }
                }
            };

            questionEditor.Show();
        }
예제 #3
0
        private void MoveUpStrip_Click(object sender, EventArgs e)
        {
            editor.changes = true;

            foreach (Control c in Parent.Controls)
            {
                QPanel qpc = c as QPanel;
                if (qpc.ID == ID - 1)
                {
                    Top    = c.Top;
                    c.Top += Height + 6;

                    editor.questions[ID]     = qpc.question;
                    editor.questions[ID - 1] = question;

                    qpc.ID++;
                    ID--;

                    break;
                }
            }

            owner.ScrollControlIntoView(this);
        }