Ejemplo n.º 1
0
        private void VerifyXzt()
        {
            DataTable dt = Tools.DataTableTools.ConstructDataTable(new string[] {
                "学号",
                "题号",
                "图片",
                "你的答案",
                "A",
                "B",
                "C",
                "D",
                "是否多选",
                "是否修改"
            });
            int xztcnt = _artemplate.XztRect.Count;
            int runcnt = 0;

            foreach (DataRow dr in _rundt.Rows)
            {
                runcnt++;
                bool b  = false;
                int  xi = 0;
                for (; xi < xztcnt; xi++)
                {
                    if (!"ABCD".Contains(dr["x" + (xi + 1)].ToString()) || dr["x" + (xi + 1)].ToString().Length > 1)
                    {
                        b = true;
                        break;
                    }
                }
                if (b)
                {
                    string fn = dr["文件名"].ToString().Replace("LJH\\", "LJH\\Correct\\");
                    if (File.Exists(fn))
                    {
                        double angle = (double)(dr["校验角度"]);
                        Bitmap bmp   = (Bitmap)Bitmap.FromFile(fn);
                        if (_angle != null)
                        {
                            _angle.SetPaper(angle);
                        }
                        AddDataToDt(dr, bmp, dt);
                    }
                }
                if (b || runcnt == _rundt.Rows.Count)
                {
                    if (dt.Rows.Count > 20 || (runcnt == _rundt.Rows.Count && dt.Rows.Count > 0))
                    {
                        FormVerify f = new FormVerify(dt);
                        if (f.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                        {
                            MessageBox.Show("校验失败");
                        }
                        //修改之后
                        dt.Rows.Clear();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        //暂时不起作用
        private void VerifyKaoHao()
        {
            DataTable dt = Tools.DataTableTools.ConstructDataTable(new string[] {
                "学号",
                "图片",
                "姓名",
                "是否修改"
            });
            Rectangle r = _artemplate.Dic["考号"][0].ImgArea;

            foreach (DataRow dr in _rundt.Rows)
            {
                if (dr["考号"].ToString() == "")
                {
                    string fn = dr["文件名"].ToString().Replace("LJH\\", "LJH\\Correct\\");
                    if (File.Exists(fn))
                    {
                        double angle = (double)(dr["校验角度"]);
                        Bitmap bmp   = (Bitmap)Bitmap.FromFile(fn);
                        if (_angle != null)
                        {
                            _angle.SetPaper(angle);
                        }
                        DataRow ndr = dt.NewRow();
                        ndr["学号"] = new ValueTag(dr["考号"].ToString(), dr);

                        Bitmap nbmp = bmp.Clone(r, bmp.PixelFormat);
                        ndr["图片"]   = nbmp;
                        ndr["姓名"]   = "";
                        ndr["是否修改"] = false;
                        dt.Rows.Add(ndr);
                    }
                }
            }
            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("暂未实现,待修改");
                FormVerify f = new FormVerify(dt);
                if (f.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                {
                    MessageBox.Show("校验失败");
                }
                //修改之后
                dt.Rows.Clear();
            }
        }