Example #1
0
        private Image CaptureScreen(int with, int height, int xLocation, int yLocation)
        {
            Rectangle     screenSize    = Screen.PrimaryScreen.Bounds;
            ClassSettings classSettings = new ClassSettings();
            Bitmap        target        = new Bitmap(with, height);

            int cursorX = Cursor.Position.X - xLocation;
            int cursorY = Cursor.Position.Y - yLocation;

            using (Graphics g = Graphics.FromImage(target))
            {
                g.CopyFromScreen(xLocation, yLocation, 0, 0, new Size(screenSize.Width, screenSize.Height));
                g.DrawImage(Image.FromFile(classSettings.GetProperties().generalsSttings.programPath + "\\icons\\color\\icons8-cursor-32.png"), cursorX, cursorY);
            }
            return(target);
        }
        private void Scan()
        {
            List <Image> images = scan2.start();

            if (images.Count < 1)
            {
                return;
            }

            TreeNode      treeNode      = classTree.TreeViewDialog("Выберите папку", "Выбрать");
            ClassFiles    classFiles    = new ClassFiles();
            int           idFolder      = Convert.ToInt32(treeNode.Name.Split('_')[1]);
            ClassTypeCard classTypeCard = new ClassTypeCard();
            int           idCard        = classTypeCard.getIdByName(ClassTypeCard.EMPTY_CARD);
            string        pathSave      = treeNode.FullPath;
            string        tmpPath       = classSettings.GetProperties().generalsSttings.programPath + @"\tmp";

            Directory.CreateDirectory(tmpPath);

            int iterator = 0;

            foreach (Image image in images)
            {
                PictureBox pictureBox = new PictureBox
                {
                    Size     = new System.Drawing.Size(800, 600),
                    SizeMode = PictureBoxSizeMode.Zoom,
                    Image    = image
                };

                if (pictureBox.Image == null)
                {
                    pictureBox.Dispose();
                    continue;
                }

                string fileName = "image_" + DateTime.UtcNow.ToString().Replace(":", "-") + "_" + iterator + ".jpg";
                pictureBox.Image.Save(tmpPath + @"\" + fileName);
                classFiles.Create(idFolder, idCard, fileName, tmpPath + @"\" + fileName, pathSave);
                classTree.InitTreeView(treeView1);

                iterator++;
            }
        }
Example #3
0
 public ClassVerifycationFiles()
 {
     root = classSettings.GetProperties().generalsSttings.programPath;
     //formVerifycationFiles.Show();
 }