Esempio n. 1
0
        public void SetItem(string answer, string selectAnswer)
        {
            _opa                      = screenWidth - 80;
            _lOpa                     = _opa * 0.65;
            _rOpa                     = _opa * 0.35;
            _lineMax                  = _lOpa - 125;
            _itemW                    = 125;
            _aH                       = this.panel2.Height - 20;
            _labelH                   = 34;
            _pTop                     = 20;
            _pLeft                    = 20;
            itemValueCanvas           = new PictureBox();
            itemValueCanvas.BackColor = System.Drawing.Color.White;
            if (answerList.Length == 6)
            {
                itemValueCanvas.Location = new System.Drawing.Point(_itemW, 20);
            }
            else
            {
                itemValueCanvas.Location = new System.Drawing.Point(_itemW, 60);
            }
            itemValueCanvas.Name     = "itemValue";
            itemValueCanvas.Size     = new System.Drawing.Size((int)_lineMax, _aH);
            itemValueCanvas.TabIndex = 0;
            itemValueCanvas.TabStop  = false;
            this.panel2.Controls.Add(itemValueCanvas);


            //////////////////////////////////////
            // 右侧正确答案
            //////////////////////////////////////
            answerBox           = new PictureBox();
            answerBox.BackColor = System.Drawing.Color.White;
            answerBox.Location  = new System.Drawing.Point((int)_lineMax + 125 + _pLeft, 0);
            answerBox.Name      = "answerBox";
            answerBox.Size      = new System.Drawing.Size((int)_rOpa, _aH);
            answerBox.TabIndex  = 0;
            answerBox.TabStop   = false;
            if (answer != null && answer.Length > 0)
            {
                this.panel2.Controls.Add(answerBox);
            }

            //
            PictureBox answerTextBox = new PictureBox();

            answerTextBox.BackColor = System.Drawing.Color.Transparent;
            answerTextBox.Location  = new System.Drawing.Point(((int)_rOpa - 210) / 2, 70);
            answerTextBox.Name      = "answerTextBox";
            answerTextBox.Size      = new System.Drawing.Size(210, 210);
            answerTextBox.TabIndex  = 0;
            answerTextBox.TabStop   = false;
            if (answer != null && answer.Length > 0)
            {
                answerBox.Controls.Add(answerTextBox);
            }


            //正确答案几个字
            PictureBox answerDescBox = new PictureBox();

            answerDescBox.BackColor = System.Drawing.Color.Transparent;
            answerDescBox.Location  = new System.Drawing.Point(48, 40);
            answerDescBox.Name      = "answerDescBox";
            answerDescBox.Size      = new System.Drawing.Size(210, 210);
            answerDescBox.TabIndex  = 0;
            answerDescBox.TabStop   = false;
            if (answer != null && answer.Length > 0)
            {
                answerTextBox.Controls.Add(answerDescBox);
            }


            canvases = new ArrayList();
            for (int i = 0; i < answerList.Length; i++)
            {
                Label label = new Label();
                label.Font      = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                label.ForeColor = System.Drawing.Color.FromArgb(102, 194, 217);
                Image lbimg = global::RueHelper.Properties.Resources.unanswer;
                if (answerList.Length == 6)
                {
                    if (answerList[i] == selectAnswer)
                    {
                        lbimg           = global::RueHelper.Properties.Resources.answer;
                        label.ForeColor = System.Drawing.Color.White;
                    }
                    label.Location = new System.Drawing.Point(_pLeft, (i + 1) * _pTop + (i * _labelH) + 20);
                }
                else
                {
                    string _temp = "✘";
                    if (selectAnswer == "R")
                    {
                        _temp = "✔";
                    }
                    if (answerList[i] == _temp)
                    {
                        lbimg           = global::RueHelper.Properties.Resources.answer;
                        label.ForeColor = System.Drawing.Color.White;
                    }
                    label.Location = new System.Drawing.Point(_pLeft, (i + 1) * _pTop + (i * _labelH) + 60);
                }
                label.Image     = lbimg;
                label.Name      = "answeritem_" + i;
                label.Size      = new System.Drawing.Size(105, _labelH);
                label.TabIndex  = 0;
                label.Text      = answerList[i];
                label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                this.panel2.Controls.Add(label);
                PictureBox canvas = new PictureBox();
                canvas.BackColor = System.Drawing.Color.White;
                canvas.Location  = new System.Drawing.Point(_pLeft, (i + 1) * _pTop + (i * _labelH));
                canvas.Name      = "itemValueCanvas" + i;
                canvas.Size      = new System.Drawing.Size((int)_lineMax, _labelH);
                canvas.TabIndex  = 0;
                canvas.TabStop   = false;
                itemValueCanvas.Controls.Add(canvas);
                canvases.Add(canvas);
            }

            AnswerCount ac = new AnswerCount();

            ac.ImageWidth   = answerBox.Width;
            ac.ImagesHeight = answerBox.Height;
            if (answer == "W")
            {
                ac.AnswerText = "✘";
            }
            else if (answer == "R")
            {
                ac.AnswerText = "✔";
            }
            else
            {
                ac.AnswerText = answer;
            }
            ac.AnswerFamily     = "Arial";
            ac.AnswerFontSize   = 86f;
            ac.FontStyle        = System.Drawing.FontStyle.Bold;
            ac.AnswerColor      = Brushes.ForestGreen;
            ac.TextX            = 46;
            ac.TextY            = 70;
            answerTextBox.Image = ac.DrawingString();
            AnswerCount acd = new AnswerCount();

            acd.ImageWidth      = answerDescBox.Width;
            acd.ImagesHeight    = answerDescBox.Height;
            acd.AnswerText      = "正确答案";
            acd.AnswerFamily    = "微软雅黑";
            acd.AnswerFontSize  = 20f;
            acd.FontStyle       = System.Drawing.FontStyle.Regular;
            acd.AnswerColor     = Brushes.Black;
            acd.TextX           = 0;
            acd.TextY           = 0;
            answerDescBox.Image = acd.DrawingString();
            animate             = new Animate(canvases, _lineMax, _rightAnswerIndex, _labelH, _rOpa, countValues, answerBox, itemValueCanvas, peopleValues);
            animate.StartAnimate();
        }
Esempio n. 2
0
        public Form11(string answer, ArrayList al)
        {
            InitializeComponent();


            this.panel2.Width     = screenWidth - 40;
            this.panel2.Height    = screenHeight - 100;
            this.panel2.Location  = new System.Drawing.Point(20, 100);
            this.pictureBox2.Size = new System.Drawing.Size(423, 540);//恭喜以下同学获得奖励
            _opa             = screenWidth - 80;
            _lOpa            = _opa * 0.65;
            _rOpa            = _opa * 0.35;
            _lineMax         = _lOpa - 125;
            _aH              = this.panel2.Height - 20;
            _labelH          = 34;
            _pLeft           = 20;
            this.WindowState = FormWindowState.Maximized;
            this.TopMost     = true;
#if DEBUG
            this.TopMost = false;//form11,zzz
#endif

            PictureBox answerBox = new PictureBox();
            answerBox.BackColor = System.Drawing.Color.White;
            answerBox.Location  = new System.Drawing.Point((int)_lineMax + 125 + _pLeft, 0);
            answerBox.Name      = "answerBox";
            answerBox.Size      = new System.Drawing.Size((int)_rOpa, _aH);
            answerBox.TabIndex  = 0;
            answerBox.TabStop   = false;
            PictureBox answerTextBox = new PictureBox();
            answerTextBox.BackColor = System.Drawing.Color.Transparent;
            answerTextBox.Location  = new System.Drawing.Point(((int)_rOpa - 210) / 2, 70);
            answerTextBox.Name      = "answerTextBox";
            answerTextBox.Size      = new System.Drawing.Size(210, 210);
            answerTextBox.TabIndex  = 0;
            answerTextBox.TabStop   = false;
            answerBox.Controls.Add(answerTextBox);
            PictureBox answerDescBox = new PictureBox();
            answerDescBox.BackColor = System.Drawing.Color.Transparent;
            answerDescBox.Location  = new System.Drawing.Point(48, 40);
            answerDescBox.Name      = "answerDescBox";
            answerDescBox.Size      = new System.Drawing.Size(210, 210);
            answerDescBox.TabIndex  = 0;
            answerDescBox.TabStop   = false;
            answerTextBox.Controls.Add(answerDescBox);
            this.panel2.Controls.Add(answerBox);
            AnswerCount ac = new AnswerCount();
            ac.ImageWidth   = answerBox.Width;
            ac.ImagesHeight = answerBox.Height;
            ac.TextX        = 46;
            ac.TextY        = 70;
            if (answer == "W")
            {
                ac.TextX      = 35;
                ac.AnswerText = "✘";//×
            }
            else if (answer == "R")
            {
                ac.TextX      = 35;
                ac.AnswerText = "✔";//√
            }
            else
            {
                ac.AnswerText = answer;
            }
            ac.AnswerFamily   = "Arial";
            ac.AnswerFontSize = 86f;
            ac.FontStyle      = System.Drawing.FontStyle.Bold;
            ac.AnswerColor    = Brushes.ForestGreen;

            answerTextBox.Image = ac.DrawingString();
            AnswerCount acd = new AnswerCount();
            acd.ImageWidth      = answerDescBox.Width;
            acd.ImagesHeight    = answerDescBox.Height;
            acd.AnswerText      = "正确答案";
            acd.AnswerFamily    = "微软雅黑";
            acd.AnswerFontSize  = 20f;
            acd.FontStyle       = System.Drawing.FontStyle.Regular;
            acd.AnswerColor     = Brushes.Black;
            acd.TextX           = 0;
            acd.TextY           = 0;
            answerDescBox.Image = acd.DrawingString();
            animate             = new Animate(_lineMax, _labelH, _rOpa, answerBox, System.Drawing.Color.FromArgb(68, 176, 102));
            animate.StartAnimate();

            if (al.Count == 0)
            {
                this.pictureBox2.Image = global::RueHelper.Properties.Resources.goog0;//很遗憾,没有答对哦
            }

            for (int i = 0; i < al.Count; i++)
            {
                Label l = new Label();
                if (i == 0)
                {
                    l.Location = new System.Drawing.Point(160, 200);
                    l.Image    = global::RueHelper.Properties.Resources.jp3;
                }
                else if (i == 1)
                {
                    l.Location = new System.Drawing.Point(34, 264);
                    l.Image    = global::RueHelper.Properties.Resources.jp2;
                }
                else if (i == 2)
                {
                    l.Location = new System.Drawing.Point(290, 290);
                    l.Image    = global::RueHelper.Properties.Resources.jp1;
                }
                l.Size      = new System.Drawing.Size(114, 100);
                l.AutoSize  = false;
                l.Text      = al[i].ToString();
                l.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
                l.Font      = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                this.pictureBox2.Controls.Add(l);
            }
        }