Example #1
0
        private void SetQuestionPanelVar(string questionName, List <Answer> ans, int questionNum)
        {
            questionNameTextBox.Text = questionName;
            questionNumber.Text      = questionNum + "";
            List <AnswerPanel> ap = new List <AnswerPanel>();

            foreach (Control p in AnswersPanel.Controls)
            {
                if (p.GetType().ToString() == "QuizMaker.AnswerPanel")
                {
                    ap.Add((AnswerPanel)p);
                }
            }

            ResetAnswers(ap);

            foreach (Answer a in ans)
            {
                AnswerPanel aP = new AnswerPanel();
                aP.SetAnswerName(a.GetAnswer());
                aP.SetCorrection(a.IsCorrect());
                aP.Location = nextAnswerBtn.Location;

                //μετακινηση των κουμπιών + και - προς τα κατω
                nextAnswerBtn.Location = new Point(nextAnswerBtn.Location.X, nextAnswerBtn.Location.Y + 33);
                delAnswerBtn.Location  = new Point(delAnswerBtn.Location.X, delAnswerBtn.Location.Y + 33);
                AnswersPanel.Controls.Add(aP);
            }
        }
Example #2
0
        private void nextAnswerBtn_Click(object sender, EventArgs e)
        {
            AnswerPanel ap = new AnswerPanel();

            ap.Location = ((Button)sender).Location;

            //μετακινηση των κουμπιών + και - προς τα κατω
            nextAnswerBtn.Location = new Point(nextAnswerBtn.Location.X, nextAnswerBtn.Location.Y + 33);
            delAnswerBtn.Location  = new Point(delAnswerBtn.Location.X, delAnswerBtn.Location.Y + 33);
            AnswersPanel.Controls.Add(ap);
        }
Example #3
0
        private List <Answer> getAnswers()
        {
            List <Answer> ans = new List <Answer>();

            AnswerPanel ap = new AnswerPanel();

            ap = null;
            foreach (Control p in AnswersPanel.Controls)
            {
                if (p.GetType().ToString() == "QuizMaker.AnswerPanel")
                {
                    ap = (AnswerPanel)p;
                    Answer an = new Answer(ap.GetAnswerName(), ap.GetCorrection());
                    ans.Add(an);
                }
            }
            return(ans);
        }
Example #4
0
        private void delAnswerBtn_Click(object sender, EventArgs e)
        {
            AnswerPanel ap = new AnswerPanel();

            ap = null;
            foreach (Control p in AnswersPanel.Controls)
            {
                if (p.GetType().ToString() == "QuizMaker.AnswerPanel")
                {
                    ap = (AnswerPanel)p;
                }
            }
            if (ap != null)
            {
                ap.Dispose();
                //μετακινηση των κουμπιών + και - προς τα πανω
                nextAnswerBtn.Location = new Point(nextAnswerBtn.Location.X, nextAnswerBtn.Location.Y - 33);
                delAnswerBtn.Location  = new Point(delAnswerBtn.Location.X, delAnswerBtn.Location.Y - 33);
            }
        }