示例#1
0
        private void ErrorReturnForm_Load(object sender, EventArgs e)
        {
            if (!this.DesignMode)
            {
                TopicShow topic = null;
                for (int i = 0; i < topics.Count; i++)
                {
                    topic = topics[i];
                    if (!topic.IsRightAnswer)
                    {
                        this.dataGridView1.Rows.Add(new string[] {
                            topic.Number.ToString(), topic.Topic.TopicText,
                            topic.Topic.Answer,
                            topic.Answer
                        });
                    }
                }
                if (this.dataGridView1.Rows.Count > 0)
                {
                    string index = this.dataGridView1.Rows[0].Cells[0].Value.ToString();
                    int    i     = Convert.ToInt32(index);
                    this.ShowTopic(i - 1);
                }

                else
                {
                    this.lbNum.Text        = String.Empty;
                    this.lbRealAnswer.Text = string.Empty;
                    this.lbUserAnswer.Text = string.Empty;
                }
            }
        }
示例#2
0
        void ctr_Click(object sender, EventArgs e)
        {
            Control ctr = sender as Control;

            TopicShow topicShow = ctr as TopicShow;

            if (topicShow == null)
            {
                topicShow = ctr.Parent as TopicShow;
            }
            this.ActiveTopic(topicShow.Number - 1);
        }
示例#3
0
        private void button6_Click(object sender, EventArgs e)
        {
            Button btn = sender as Button;

            this.lbAnswer.Text = btn.Text;
            if (this.currentTopic >= 0)
            {
                TopicShow topicShow = this.groupBox3.Controls[this.currentTopic] as TopicShow;
                topicShow.SetAnswer(btn.Text);
                if (this.currentTopic != this.topics.Count - 1)
                {
                    this.ActiveTopic(this.currentTopic + 1);
                }
            }
        }
示例#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);
        }
示例#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);
        }
示例#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);
                }
            }
        }