Ejemplo n.º 1
0
 public TopicShow(int num, ExamTopic topic) : this()
 {
     this.topic         = topic;
     this.num           = num;
     this.lbNum.Text    = num.ToString();
     this.lbAnswer.Text = string.Empty;
 }
Ejemplo n.º 2
0
 public TopicShow(int num,ExamTopic topic)
     : this()
 {
     this.topic = topic;
     this.num = num;
     this.lbNum.Text = num.ToString();
     this.lbAnswer.Text = string.Empty;
 }
Ejemplo n.º 3
0
        private void ShowTopic(int index)
        {
            ExamTopic exam = topics[index].Topic;

            this.txtTopic.Text = topics[index].Number.ToString() + ":" + exam.TopicText +
                                 "\r\n\r\n" + (exam.AnswerA == string.Empty ? "" : "A " + exam.AnswerA)
                                 + "\r\n" + (exam.AnswerB == string.Empty ? "" : "B " + exam.AnswerB)
                                 + "\r\n" + (exam.AnswerC == string.Empty ? "" : "C " + exam.AnswerC) +
                                 "\r\n" + (exam.AnswerD == string.Empty ? "" : "D " + exam.AnswerD);
            this.lbNum.Text = topics[index].Number.ToString();
            if (this.picImage.Image != null)
            {
                this.picImage.Image.Dispose();
                this.picImage.Image = null;
            }
            if (exam.PicPath != null && exam.PicPath.Length > 0)
            {
                this.picImage.Image = Image.FromFile(exam.PicPath);
            }
            this.lbUserAnswer.Text = topics[index].Answer;
            this.lbRealAnswer.Text = exam.Answer;
        }
Ejemplo n.º 4
0
        private void BuildATopicControl(ExamTopic topic)
        {
            int       i   = this.groupBox3.Controls.Count;
            TopicShow ctr = new TopicShow(i + 1, topic);

            this.topicsControl.Add(ctr);
            if (i <= 19)
            {
                //ctr.Location = new Point(this.groupBox3.Location.X + (i % 20 ) * 45, this.groupBox3.Location.Y);
                ctr.Location = new Point(5 + (i % 20) * 45 - (i > 0?1 * i:0), 20);
            }
            else
            {
                //ctr.Location = new Point(this.groupBox3.Location.X + (i % 20 - 1) * 45, this.groupBox3.Location.Y + (i / 20) * 45);
                ctr.Location = new Point(5 + (i % 20) * 45 - (i % 20 > 0 ? (i % 20) : 0), 20 + (i / 20) * 45 - (i / 20));
            }

            ctr.Click += new EventHandler(ctr_Click);
            for (int j = 0; j < ctr.Controls.Count; j++)
            {
                ctr.Controls[j].Click += new EventHandler(ctr_Click);
            }
            this.groupBox3.Controls.Add(ctr);
        }
Ejemplo n.º 5
0
        private void BuildATopicControl(ExamTopic topic)
        {
            int i=this.groupBox3.Controls.Count;
            TopicShow ctr = new TopicShow(i + 1, topic);
            this.topicsControl.Add(ctr);
            if(i<=19)
            {
                //ctr.Location = new Point(this.groupBox3.Location.X + (i % 20 ) * 45, this.groupBox3.Location.Y);
                ctr.Location = new Point(5+(i % 20) * 45-(i>0?1*i:0), 20);
            }
            else
            {
                //ctr.Location = new Point(this.groupBox3.Location.X + (i % 20 - 1) * 45, this.groupBox3.Location.Y + (i / 20) * 45);
                ctr.Location = new Point(5 + (i % 20) * 45 - (i%20 > 0 ? (i%20) : 0), 20 + (i / 20) * 45-(i/20));
            }

            ctr.Click += new EventHandler(ctr_Click);
            for (int j = 0; j < ctr.Controls.Count;j++ )
            {
                ctr.Controls[j].Click += new EventHandler(ctr_Click);
            }
            this.groupBox3.Controls.Add(ctr);
        }
Ejemplo n.º 6
0
        private void ActiveTopic(int index)
        {
            TopicShow topicShow = null;

            if (this.currentTopic > -1)
            {
                topicShow = this.groupBox3.Controls[this.currentTopic] as TopicShow;
                topicShow.SetActive(false);
            }

            topicShow = this.groupBox3.Controls[index] as TopicShow;
            topicShow.SetActive(true);
            this.lbAnswer.Text = topicShow.Answer;
            this.currentTopic  = index;
            if (index == 0)
            {
                this.btnNext.Enabled = true;
                this.btnPrev.Enabled = false;
            }
            else if (index == this.topics.Count - 1)
            {
                this.btnPrev.Enabled = true;
                this.btnNext.Enabled = false;
            }
            else
            {
                this.btnPrev.Enabled = true;
                this.btnNext.Enabled = true;
            }
            ExamTopic tmp = this.topics[index] as ExamTopic;

            if (tmp != null)
            {
                if (tmp.TopicType == "1")
                {
                    this.btnA.Visible   = false;
                    this.btnB.Visible   = false;
                    this.btnC.Visible   = false;
                    this.btnD.Visible   = false;
                    this.btnY.Visible   = true;
                    this.btnN.Visible   = true;
                    this.lbAnswerA.Text = string.Empty;
                    this.lbAnswerB.Text = string.Empty;
                    this.lbAnswerC.Text = string.Empty;
                    this.lbAnswerD.Text = string.Empty;
                }
                else
                {
                    this.btnA.Visible   = true;
                    this.btnB.Visible   = true;
                    this.btnC.Visible   = true;
                    this.btnD.Visible   = true;
                    this.btnY.Visible   = false;
                    this.btnN.Visible   = false;
                    this.lbAnswerA.Text = "A " + tmp.AnswerA;
                    this.lbAnswerB.Text = "B " + tmp.AnswerB;
                    this.lbAnswerC.Text = "C " + tmp.AnswerC;
                    this.lbAnswerD.Text = "D " + tmp.AnswerD;
                }
                this.lbTopic.Text = tmp.TopicText;
                if (this.picImage.Image != null)
                {
                    this.picImage.Image.Dispose();
                    this.picImage.Image = null;
                }
                if (tmp.PicPath != null && tmp.PicPath.Length > 0)
                {
                    this.picImage.Image = Image.FromFile(tmp.PicPath);
                }
            }
        }