Exemplo n.º 1
0
        public FormAward(int id, string name, int point, string reason, string reasonid)
        {
            InitializeComponent();
            al               = new ArrayList();
            this.Text        = "奖励";
            this.WindowState = FormWindowState.Maximized;
            this.Show();
            this.BringToFront();
            this.TopMost = true;
            this.point   = point;
#if DEBUG
            this.TopMost = false;//Form10 CallName,zzz
#endif
            int label2Width = 500;
            this.pictureBox2.Location = new System.Drawing.Point((screenWidth - this.pictureBox2.Width) / 2, (screenHeight - this.pictureBox2.Height) / 2 - 170);
            this.label2.Location      = new System.Drawing.Point((screenWidth - label2Width) / 2, screenHeight / 2 - 50);

            this.label2.Text = name;
            STName           = name;
            STID             = id + "";

            int grade = Global.getGrade();
            if (grade > 6)
            {
                bHighSchool = true;
            }
            ////自动隐藏
            //System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
            //t.Interval = 4000;
            //t.Tick += new EventHandler(t_Tick);
            //t.Start();
        }
Exemplo n.º 2
0
        public Form10(string studentinfo, string data, int id, string name)
        {
            InitializeComponent();
            al               = new ArrayList();
            this.Text        = "点名";
            this.WindowState = FormWindowState.Maximized;

            this.TopMost = true;
#if DEBUG
            this.TopMost = false;//Form10 CallName,zzz
#endif
            if (Global.getGrade() > 6)
            {
                bHighSchool = true;
            }

            if (bHighSchool)
            {
                //点名提问 姓名框
                this.label1.Size     = new System.Drawing.Size(401, 174);//394,167
                this.label1.Image    = global::RueHelper.Properties.Resources.nameshow;
                this.label1.Location = new System.Drawing.Point((screenWidth - this.label1.Width) / 2, (screenHeight - this.label1.Height) / 2 + 30);
                //this.label1.ForeColor = System.Drawing.Color.Black;
                //this.label1.ForeColor = System.Drawing.ColorTranslator.FromHtml("#5748A5");
                //this.label1.Font = new System.Drawing.Font("微软雅黑", 42F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));

                //点名提问图片框
                this.pictureBox1.Visible  = false;
                this.pictureBox1.Location = new System.Drawing.Point((screenWidth - this.pictureBox1.Width) / 2 - 10, label1.Top - pictureBox1.Height - 20);

                //点名提问文本框
                this.label3.Visible  = true;
                this.label3.Location = new System.Drawing.Point((screenWidth - 219) / 2, label1.Top - 90);
                this.label3.Text     = "点 名 提 问";
                this.label3.Font     = new System.Drawing.Font("微软雅黑", 30F);

                this.label2.Visible = false;
            }
            else
            {
                //点名提问图片框
                this.pictureBox1.Visible  = true;
                this.pictureBox1.Location = new System.Drawing.Point((screenWidth - this.pictureBox1.Width) / 2 - 10, label1.Top - pictureBox1.Height - 20);

                this.label1.Size     = new System.Drawing.Size(408, 179);//401,172
                this.label1.Location = new System.Drawing.Point((screenWidth - this.label1.Width) / 2, (screenHeight - this.label1.Height) / 2 + 50);
                this.label2.Location = new System.Drawing.Point(label1.Left, label1.Top);

                this.pictureBox2.Location = new System.Drawing.Point((screenWidth - this.pictureBox2.Width) / 2, (screenHeight - this.pictureBox2.Height) / 2 - 200);
                this.label3.Size          = new System.Drawing.Size(288, 50);
                this.label3.Location      = new System.Drawing.Point((screenWidth - this.label3.Width) / 2 + 10, pictureBox1.Top + 30);
                this.label1.Image         = global::RueHelper.Properties.Resources.nameshow;
            }

            ClassInfo ci = JsonOper.DeserializeJsonToObject <ClassInfo>(studentinfo);
            si = ci.Data.Student;

            if (name.Length == 0 && data.Length > 0)//随机点名
            {
                for (int i = 0; i < data.Split('|').Length - 1; i++)
                {
                    int    num        = Convert.ToInt16(data.Split('|')[i].Split(':')[0].ToString().Replace("-", ""));
                    string answer     = data.Split('|')[i].Split(':')[1];
                    int    _answerLen = answer.Split(';').Length;
                    string getAnswer  = "";
                    if (_answerLen == 1)
                    {
                        getAnswer = answer.Split(';')[_answerLen - 1].Split(',')[1];
                    }
                    else
                    {
                        getAnswer = answer.Split(';')[_answerLen - 2].Split(',')[1];
                    }
                    al.Add(num + ":" + getAnswer);
                }
                Random    rd      = new Random();
                ArrayList _tempAl = new ArrayList();
                for (int i = 0; i < al.Count; i++)
                {
                    int    _num = Convert.ToInt16(al[i].ToString().Split(':')[0].ToString());
                    string s1   = si[_num - 1].Name;
                    if (CheckAL(s1))
                    {
                        _tempAl.Add(al[i].ToString());
                    }
                }
                bool insert = true;
                if (_tempAl.Count == 0)
                {
                    insert  = false;
                    _tempAl = al;
                }
                int    r      = rd.Next(_tempAl.Count);
                string temp   = _tempAl[r].ToString();
                int    number = Convert.ToInt16(temp.Split(':')[0].ToString());//No.
                string stname = si[number - 1].Name;
                this.label1.Text = stname;
                STName           = stname;
                STID             = temp.Split(':')[0].ToString();
                if (insert)
                {
                    StudentInfo newSI = new StudentInfo();
                    newSI.Name = stname;
                    studentResult.Add(newSI);
                }
            }
            else//制定点名
            {
                STName = name;
                STID   = id + "";
            }
            this.label1.Text = STName;
            //this.Show();
            //this.BringToFront();


            //3秒显示,自动隐藏
            System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
            t.Interval = 2000;//2秒
            t.Tick    += new EventHandler(t_Tick);
            t.Start();
        }