Пример #1
0
        public override void start()
        {
            Console.WriteLine("start()");
            base.start();
            List <Bitmap> im = new List <Bitmap>();

            im.Add((Bitmap)BackgroundImage);
            var rects = PageSizeFinder.findPageInAlmostFullScreenImages(im, _background, _locationOfBackground.X, _locationOfBackground.Y);

            //skallierung
            UnScaleRectSelection(rects[0]);
            Console.WriteLine("rects[0]: " + rects[0]);
            Console.WriteLine("rects[0]: " + _rectSelection);
            Console.WriteLine("rects[0]: " + _grabRectangle);
            Refresh(); // -> OnPaint
            DialogResult result = MessageBox.Show("Auswahl ok?", "Title", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (result.Equals(DialogResult.No))
            {
                _showGrabRectangle = true;
                getGrabRectangle(_rectSelection);
                BackgroundImage = _deskTopScreenShot;
                Refresh();
                DialogResult result2 = MessageBox.Show("Rahmen ok?", "Title", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                //this.Close();
                //throw new NotImplementedException();   //blockiert dann alles
            }
            else
            {
                _showGrabRectangle = false;
                Refresh();
                Done();
            }
        }
Пример #2
0
        public ChooseAreaToolAutomatic(Image desktopScreenShot, int x, int y, int width, int height /*, int screenNumber*/, Color background, Point locationOfBackground, Screen screen) :
            base(desktopScreenShot, x, y, width, height, screen)
        {
            Console.WriteLine("ChooseAreaToolAutomatic");
            _background           = background;
            _locationOfBackground = locationOfBackground;
            List <Bitmap> testPictures = new List <Bitmap>();

            testPictures.Add((Bitmap)desktopScreenShot);
            List <Rectangle> rectangles = PageSizeFinder.findPageInAlmostFullScreenImages(testPictures, background, locationOfBackground.X, locationOfBackground.Y);

            //Now take first page. TODO some check if we have poorly chosen.
            _rectSelection = rectangles[0];
        }
Пример #3
0
        public void findPageInFullScreenImagesTest2()
        {
            //Testbilder holen
            //Result: X=9,Y=284,Width=1048,Height=1363
            List <Bitmap> testPictures = new List <Bitmap>();

            testPictures.Add(new Bitmap(Image.FromFile(@"C:\Users\user\Documents\Visual Studio 2015\Projects\handlesPdf\WindowsFormsApplication2\testShoots\testpage.png")));
            Color            c     = Color.FromArgb(255, 128, 128, 128);
            List <Rectangle> rects = PageSizeFinder.findPageInAlmostFullScreenImages(testPictures, c, 300, 1700);

            Rectangle r;

            r = rects[0];
            Console.WriteLine(r);
        }
Пример #4
0
        public void findPageInFullScreenImagesTest()
        {
            //Testbilder holen
            List <Bitmap> testPictures = new List <Bitmap>();

            testPictures.Add(new Bitmap(Image.FromFile(@"C:\Users\user\Documents\Visual Studio 2015\Projects\handlesPdf\WindowsFormsApplication2\testShoots\a_Page.png")));
            testPictures.Add(new Bitmap(Image.FromFile(@"C:\Users\user\Documents\Visual Studio 2015\Projects\handlesPdf\WindowsFormsApplication2\testShoots\coverFull.png")));
            testPictures.Add(new Bitmap(Image.FromFile(@"C:\Users\user\Documents\Visual Studio 2015\Projects\handlesPdf\WindowsFormsApplication2\testShoots\rectangles on black.png")));

            List <Rectangle> rects = PageSizeFinder.findPageInFullScreenImages(testPictures);

            Rectangle r;

            r = rects[0];
            Console.WriteLine(r);
            Assert.IsTrue(r.X == 141 && r.Y == 0 && r.Width == 1636 && r.Height == 1078);
            r = rects[1];
            Console.WriteLine(r);
            Assert.IsTrue(r.X == 141 && r.Y == 0 && r.Width == 1636 && r.Height == 1078);
            r = rects[2];
            Console.WriteLine(r);
            Assert.IsTrue(r.X == 222 && r.Y == 88 && r.Width == 1518 && r.Height == 647);
        }