예제 #1
0
        //组卷
        private void combine_btn_Click(object sender, EventArgs e)
        {
            if (pageList.Count != 0)
            {
                //List<Image> newHimg = PictureMerge.transferPicture(haimgList, 1240, 0);
                //Image a = PictureMerge.JoinImage(newHimg, 0);
                //a.Save("H:/temp/组卷/odk.png");
                bim = PictureMerge.JoinImage(pageList);
                for (int i = 0; i < bim.Count; i++)
                {
                    bim[i].Save("H:/temp/组卷/odk" + i + ".png");
                    //PictureMerge.ConvertJPG2PDF("H:/temp/组卷/odk" + i + ".png", "H:/temp/组卷/odk" + i + ".pdf");
                }
                for (int i = 0; i < bim.Count; i++)
                {
                    bim[i].Dispose();
                }
                bim.Clear();
                List <string> a = new List <string>();
                a.Add("H:/temp/组卷/odk0.png");
                a.Add("H:/temp/组卷/odk1.png");
                PictureMerge.convertJpegToPDFUsingItextSharp(a);

                //PictureMerge.convertJpegToPDFUsingItextSharp(a);
                MessageBox.Show("合并完成");
                skinButton1.Visible = true;
                skinButton2.Visible = true;
            }
        }
예제 #2
0
        private void SolutionPanel_Load(object sender, EventArgs e)
        {
            Bitmap b = new Bitmap(solutionPath);
            Image  a = PictureMerge.GetThumbnail(b, 736, 0);

            pictureBox1.Image = a;
        }
예제 #3
0
        /// <summary>
        /// 确认切割点击事件处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cut_isOk_Click(object sender, EventArgs e)
        {
            int i = convert.ConfirmCut(multiple);

            if (i != 0)
            {
                if (convert.images.Count >= 0)
                {
                    foreach (Image ima in convert.images)
                    {
                        ima.Dispose();
                    }
                }
                string fileaName = convert.imagesPath[page];
                image = System.Drawing.Image.FromFile(fileaName);

                Bitmap bit    = new Bitmap(image);
                Bitmap getbit = PictureMerge.GetThumbnail(bit, show_pic.Width, 0);
                image          = getbit;
                show_pic.Image = image;

                convert.imagesPath.Remove(convert.imagesPath[convert.imagesPath.Count - 1]);
                convert.imagesPath.Remove(convert.imagesPath[convert.imagesPath.Count - 1]);
                ++count;
                //textBox1.Text = "第" + count + "题";
                //显示下一个
                skinLabel3.Visible     = true;
                all_thing_isOk.Visible = true;
            }
            else
            {
                return;
            }
        }
예제 #4
0
        private void skinButton3_Click(object sender, EventArgs e)
        {
            page++;
            //this.show_pic.Image = Image.FromFile(convert.AllImagePath[page]);
            if (convert.AllImagePath.Count > 0)
            {
                MessageBox.Show(convert.AllImagePath.Count.ToString());
                image    = System.Drawing.Image.FromFile(convert.AllImagePath[page]); //FromFile里是图片的路径;
                oldImage = image;
                cutPath  = convert.AllImagePath[page];                                //切割而成的图片保存的地方
                multiple = ((double)image.Width) / show_pic.Width;                    //得到原图片和pictureBox1比例,进行图片的缩略和描点的恢复
                MessageBox.Show(multiple + "  " + image.Width + "       " + show_pic.Width);
                Bitmap bit    = new Bitmap(image);
                Bitmap getbit = PictureMerge.GetThumbnail(bit, show_pic.Width, 0);//缩略图
                image          = getbit;
                show_pic.Image = image;

                /*convert.count1 = 1;
                 * convert.imagesPath.Clear();
                 * convert.imagesHeigt.Clear();
                 * convert.titles.Clear();
                 * convert.startAndEnd.Clear();
                 * convert.count = 1;*/
                image.Save(convert.AllImagePath[page].Split('.')[0] + "缩略图" + ".png");
                MessageBox.Show(convert.AllImagePath[page].Split('.')[0] + "缩略图" + ".png");
                convert.imagesPath.Add(convert.AllImagePath[page].Split('.')[0] + "缩略图" + ".png");
                convert.images.Add(image);
            }
            else
            {
                return;
            }
        }
예제 #5
0
        /*参数;图片列表
         * 参数:面板
         * 参数传递:showlist    用于保存已选择的图片
         * 参数:pictureBox   用于保存生成picturebox的列表
         * 参数:panel    传递主面板 过来   用于把控件添加到主面板中
         * 参数:pictureRightBoxlist    用于保存  右边生成的picturebox的面板
         * 参数:erroButtonRightBoxlist  用于保存   错误率的按钮列表
         * 参数:erro_count  错误率列表
         * 参数:solutionButtonRightBoxlist  解析按钮     把解析的按钮保存到这个列表 中
         * 参数:answerList    答案的地址    用于传递到解析按钮中   处理事件
         * 添加控件
         * */
        public static void createControl(List <Image> imgList, Panel panel1, List <Image> showImglist, List <MyPic> pictureBoxList, Panel panel, List <MyPic> pictureRightBoxlist, List <MyButton> erroButtonRightBoxlist, List <double> erro_count, List <MyButton> solutionButtonRightBoxlist, List <String> answerList)
        {
            int imgheight = 0;

            for (int i = 0; i < imgList.Count; i++)
            {
                Bitmap aa = new Bitmap(imgList[i]);
                Image  a  = PictureMerge.GetThumbnail(aa, 1240, 0);
                Bitmap ac = new Bitmap(a);
                Image  b  = PictureMerge.GetThumbnail(ac, 578, 0);
                Panel  p  = createPanel(0, imgheight, 578, b.Height + 25);

                MyPic pb = createPictureBox(0, 0, 578, b.Height, b);
                pb.indexCount = i;

                pb.MouseClick += (e, f) => pictureBox_MouseClick(pb, imgList[pb.indexCount], showImglist, pb.indexCount, panel, pictureRightBoxlist, imgList, pictureBoxList);
                pictureBoxList.Add(pb);

                p.CreateGraphics().DrawLine(Pens.Red, 0, b.Height, 578, b.Height);

                //graph.DrawLine(new Pen(Color.Red, 2), new System.Drawing.Font("宋体", 50, FontStyle.Bold), Brushes.DimGray, 0, iHeight);
                MyButton solution_Button = createButton("解析", 0, pb.Height + 1, 80, 23);
                if (i < answerList.Count)
                {
                    solution_Button.solutionPath = answerList[i];
                }
                solution_Button.MouseClick += (e, f) => solution_MouseClick("解析", solution_Button.solutionPath);//添加事件
                solutionButtonRightBoxlist.Add(solution_Button);
                Button join_Button = createButton("加入组卷车", 120, pb.Height + 1, 80, 23);
                join_Button.MouseClick += (e, f) => join_MouseClick("加入组卷车");

                Button remind_Button = createButton("特别提醒", 240, pb.Height + 1, 80, 23);
                remind_Button.MouseClick += (e, f) => remind_MouseClick("特别提醒");

                Button count_Button = createButton("组卷次数", 360, pb.Height + 1, 80, 23);
                count_Button.MouseClick += (e, f) => count_MouseClick("组卷次数");

                MyButton error_Button = createButton("错误率" + erro_count[i], 478, pb.Height + 1, 80, 23);
                if (i < erro_count.Count)
                {
                    error_Button.error_Count = erro_count[i];
                }
                error_Button.MouseClick += (e, f) => error_MouseClick("错误率", error_Button.error_Count);
                erroButtonRightBoxlist.Add(error_Button);

                //p.Size = new Size(578, b.Height + 23);
                p.Controls.Add(solution_Button);
                p.Controls.Add(join_Button);
                p.Controls.Add(remind_Button);
                p.Controls.Add(count_Button);
                p.Controls.Add(error_Button);
                p.Controls.Add(pb);
                if (p != null)
                {
                    panel1.Controls.Add(p);
                }
                imgheight += b.Height + 50;
            }
        }
예제 #6
0
        /*参数:图片 设置picturebox的图片
         * 参数:面板 传递面板2 修改里面的控件
         * 参数;控件列表   管理PictureBox控件
         * 参数:i   传递标记
         * 参数:imgheight    用来设置picturebox控件的位置
         * 参数:showImglist   管理显示的图片
         * 参数:imgList   管理显示的图片在imgList的索引
         * 添加控件
         * */
        public static void createRightControl(Image img, Panel panel1, List <MyPic> pictureRightBoxlist, int i, int imgheight, List <Image> showImglist, List <Image> imgList, List <MyPic> pictureBoxList)
        {
            Bitmap ac = new Bitmap(img);
            Image  b  = PictureMerge.GetThumbnail(ac, 578, 0);
            MyPic  pb = createPictureBox(0, imgheight, 578, b.Height, b);

            pb.indexCount = i;
            pictureRightBoxlist.Add(pb);
            panel1.VerticalScroll.Value = 0;
            panel1.Controls.Add(pb);
            panel1.Refresh();
            pb.MouseClick += (e, f) => pictureBoxRight_MouseClick(pb.indexCount, showImglist, imgList, pictureRightBoxlist, panel1, pictureBoxList);
            //MessageBox.Show(pb.Location.ToString());
        }
예제 #7
0
        private void skinButton3_Click(object sender, EventArgs e)
        {
            if (showImglist.Count != 0)
            {
                MessageBox.Show(showImglist.Count.ToString());

                newImgList = PictureMerge.transferPicture(showImglist, 1240, 0);
                pageList   = PictureMerge.pageTab(newImgList);
                //MessageBox.Show(showImglist.Count.ToString());
                //haimgList = new List<Image>(showImglist);
                combine_btn.Visible = true;
                skinButton2.Visible = true;
            }
        }
예제 #8
0
        private void check_Pic_Click(object sender, EventArgs e)
        {
            if (!isFind)
            {
                skinLabel2.Visible = true;
                String sqlSearch = "select 图片地址 from 题目信息表   ";

                //MySqlConnection mysql = DatabaseDao.getMySqlCon();
                //MySqlCommand mySqlCommand = DatabaseDao.getSqlCommand(sqlSearch, mysql);
                //mysql.Open();
                //path = DatabaseDao.getPicturePath(mySqlCommand);
                path.Add("H:/temp/图片/题号_A1第1题.png");
                path.Add("H:/temp/图片/题号_A1第2题.png");
                path.Add("H:/temp/图片/题号_A1第3题.png");
                path.Add("H:/temp/图片/题号_A1第4题.png");
                path.Add("H:/temp/图片/题号_A1第5题.png");
                path.Add("H:/temp/图片/题号_A1第6题.png");
                path.Add("H:/temp/图片/题号_A1第7题.png");
                path.Add("H:/temp/图片/题号_A1第8题.png");
                path.Add("H:/temp/图片/题号_A1第9题.png");
                //记得关闭
                //mysql.Close();
                imgList = PictureMerge.createImage(path);

                errorRateList.Add(2.3);
                errorRateList.Add(2.5);
                errorRateList.Add(2.8);
                errorRateList.Add(2.9);
                errorRateList.Add(5.9);
                errorRateList.Add(6.8);
                errorRateList.Add(7.8);
                errorRateList.Add(9.5);
                errorRateList.Add(9.5);

                answerList.Add("H:/temp/图片/0题号_第2题.png");
                answerList.Add("H:/temp/图片/0题号_第3题.png");
                answerList.Add("H:/temp/图片/0题号_第1题.png");
                answerList.Add("H:/temp/图片/1题号_第2题.png");
                answerList.Add("H:/temp/图片/1题号_第3题.png");
                answerList.Add("H:/temp/图片/1题号_第1题.png");
                answerList.Add("H:/temp/图片/0题号_第2题.png");
                answerList.Add("H:/temp/图片/0题号_第2题.png");
                answerList.Add("H:/temp/图片/0题号_第3题.png");
                ControlCom.createControl(imgList, skinPanel2, showImglist, pictureBoxList, skinPanel3, pictureRightBoxlist, erroButtonRightBoxlist, errorRateList, solutionButtonRightBoxlist, answerList);//生成控件

                skinButton3.Visible = true;
                isFind = true;
            }
        }
예제 #9
0
        public PreviewFrom(List <List <Image> > haimgList)
        {
            InitializeComponent();
            int fHeight = 0;
            int fWidth  = haimgList[0][0].Width;

            for (int i = 0; i < haimgList.Count; i++)
            {
                List <Image> newImgList = PictureMerge.transferPicture(haimgList[i], 578, 0);
                Image        a          = PictureMerge.PictureBoxShow2(newImgList);
                PictureBox   p          = ControlCom.createPictureBox(0, fHeight, fWidth, 818, a);
                this.panel1.Controls.Add(p);
                fHeight += 818;
                MessageBox.Show(haimgList.Count.ToString());
            }
        }
예제 #10
0
        /// <summary>
        /// 选择照片点击事件处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void choose_Pic_Click(object sender, EventArgs e)
        {
            show_pic.Enabled  = true;
            comboBox1.Visible = true;
            string path = convert.MyOpenFileDialog();

            if (path != null)
            {
                page = 0;
                string[] ImageName = path.Split('\\');
                newImageName = ImageName[ImageName.Length - 1].Split('.');
                image        = System.Drawing.Image.FromFile(path);    //FromFile里是图片的路径;
                oldImage     = image;
                cutPath      = path;                                   //切割而成的图片保存的地方
                multiple     = ((double)image.Width) / show_pic.Width; //得到原图片和pictureBox1比例,进行图片的缩略和描点的恢复
                MessageBox.Show(multiple + "  " + image.Width + "       " + show_pic.Width);
                Bitmap bit    = new Bitmap(image);
                Bitmap getbit = PictureMerge.GetThumbnail(bit, show_pic.Width, 0);//缩略图
                image          = getbit;
                show_pic.Image = image;
                convert.count1 = 1;
                convert.imagesPath.Clear();
                convert.imagesHeigt.Clear();
                convert.titles.Clear();
                convert.startAndEnd.Clear();
                convert.count = 1;
                image.Save(path.Split('.')[0] + "缩略图" + ".png");
                MessageBox.Show(path.Split('.')[0] + "缩略图" + ".png");
                convert.imagesPath.Add(path.Split('.')[0] + "缩略图" + ".png");

                convert.images.Add(image);
            }
            else
            {
            }
            //显示下一个
            skinButton2.Visible = true;
            skinLabel2.Visible  = true;
            cut_isOk.Visible    = true;
            skinButton3.Visible = true;
        }
예제 #11
0
파일: Form3.cs 프로젝트: zeroAone/hadunlike
        private void button1_Click(object sender, EventArgs e)
        {
            List <Image> img = new List <Image>();

            imgFilePath = new List <string>();
            OpenFileDialog file = new OpenFileDialog();

            file.Multiselect = true;
            file.SupportMultiDottedExtensions = true;
            file.ShowDialog();
            foreach (string path in file.FileNames)
            {
                img.Add(Image.FromFile(path));
                imgFilePath.Add(path);
            }
            pictureBox1.BackColor = Color.Black;
            Image  aPicture = PictureMerge.PictureBoxShow(img);
            Bitmap c        = new Bitmap(aPicture);
            Image  b        = PictureMerge.GetThumbnail(c, 640, 0);

            this.pictureBox1.Image = b;
        }