示例#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);
        }