예제 #1
0
        public frmUserCaptureArea(Options options, bool show)
        {
            InitializeComponent();

            this.MouseDown += new MouseEventHandler(mouse_Click);
            this.MouseUp += new MouseEventHandler(mouse_Up);
            this.MouseMove += new MouseEventHandler(mouse_Move);
            this.KeyUp += new KeyEventHandler(key_press);

            g = this.CreateGraphics();

            CaptureOptions = options;

            this.show = show;
        }
예제 #2
0
        /// <summary>
        /// It will save the new options.
        /// It will check to make sure that all the new values are correct.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (validWidth() && validHeight())
            {
                if (radFullScreen.Checked)
                {
                    UsersOptions = new Options();
                }
                else
                {
                    UsersOptions = MakeOptions();
                }

                this.DialogResult = DialogResult.OK;
            }
            else
            {
                System.Console.WriteLine("Capture area too large for the screen.");
                this.DialogResult = DialogResult.None;
            }
        }
예제 #3
0
 /// <summary>
 /// Makes a new instance of a capture worker
 /// It will capture an area using the options provided.
 /// </summary>
 /// <param name="options">The options for the capture.</param>
 /// <param name="picBox">The picture box being used to display the capture.</param>
 public CaptureWorker(Options options, PictureBox picBox)
 {
     CaptureOptions = options;
     PicBox = picBox;
 }
예제 #4
0
        /// <summary>
        /// Makes a new instance of a capture worker
        /// It will set the height and width of the capture to the full area of displays.
        /// It will be able to capture the screen over multiple displays.
        /// </summary>
        /// <param name="picBox">The picture box being used to display the capture.</param>
        public CaptureWorker(PictureBox picBox)
        {
            CaptureOptions = new Options(ScreenSize.Width, ScreenSize.Height, Point.Empty);

            PicBox = picBox;
        }
예제 #5
0
        /// <summary>
        /// Makes a new instance of a capture worker.
        /// It will capture an area from the set x and y to the set width and height.
        /// </summary>
        /// <param name="captureWidth">The width of capture area.</param>
        /// <param name="captureHeight">The height of capture area.</param>
        /// <param name="picBox">The picture box being used to display the capture.</param>
        /// <param name="x">The x co-ordinate of the source of the source</param>
        /// <param name="y">The y co-ordinate of the source of the source</param>
        public CaptureWorker(int captureWidth, int captureHeight, PictureBox picBox, int x, int y)
        {
            CaptureOptions = new Options(captureWidth, captureHeight, new Point(x, y));

            PicBox = picBox;
        }
예제 #6
0
        /// <summary>
        /// Makes a new instance of a capture worker.
        /// It will capture an area from (0, 0) to the set width and height.
        /// </summary>
        /// <param name="captureWidth">The width of capture area.</param>
        /// <param name="captureHeight">The height of capture area.</param>
        /// <param name="picBox">The picture box being used to display the capture.</param>
        public CaptureWorker(int captureWidth, int captureHeight, PictureBox picBox)
        {
            CaptureOptions = new Options(captureWidth, captureHeight, Point.Empty);

            PicBox = picBox;
        }
예제 #7
0
        /// <summary>
        /// Makes a new instance of a capture worker.
        /// It will capture an area from the source point to the set width and height.
        /// </summary>
        /// <param name="captureWidth">The width of capture area.</param>
        /// <param name="captureHeight">The height of capture area.</param>
        /// <param name="picBox">The picture box being used to display the capture.</param>
        /// <param name="sourcePoint">The source point of the capture.</param>
        public CaptureWorker(int captureWidth, int captureHeight, PictureBox picBox, Point sourcePoint)
        {
            CaptureOptions = new Options(captureWidth, captureHeight, sourcePoint);

            PicBox = picBox;
        }
예제 #8
0
 /// <summary>
 /// Gets the capture information from the form and creates, returns a new Options.
 /// </summary>
 /// <returns></returns>
 private Options MakeOptions()
 {
     return UsersOptions = new Options((int)nudWidth.Value, (int)nudHeight.Value, new Point((int)nudXSourcePoint.Value, (int)nudYSourcePoint.Value));
 }
예제 #9
0
 /// <summary>
 /// Makes a new instance of a Options menu form.
 /// </summary>
 /// <param name="options">The options that are currently doing run.</param>
 public frmOptions(Options options)
 {
     UsersOptions = options;
     InitializeComponent();
 }
예제 #10
0
        /// <summary>
        /// Opens the form to allow the user to capture their desired area. It will then load the
        /// options back into the form again.
        /// </summary>
        private void DoUserCaptureArea(bool show)
        {
            /*
             * It will check if the form is already open, if so then it will dispose it.
             * It will open the form with the current options.
            */
            if (frmUCA != null)
            {
                frmUCA.Dispose();
                frmUCA = null;
            }

            frmUCA = new frmUserCaptureArea(MakeOptions(), show);
            frmUCA.InstanceRef = this;

            this.Hide();
            Application.DoEvents();

            /*
             * If the response from the form is OK then it will get the options from user capture form and make sure that it is correct and then load them onto the form.
             */

            if (frmUCA.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                UsersOptions = frmUCA.CaptureOptions;

                if (UsersOptions.Width < ScreenSize.Width && UsersOptions.Height < ScreenSize.Height)
                {
                    UsersOptions.Fullscreen = false;
                }

                UsersOptions.SourcePoint = new Point(UsersOptions.SourcePoint.X + ScreenSize.TopLeftPoint.X, UsersOptions.SourcePoint.Y + ScreenSize.TopLeftPoint.Y);

                LoadOptions();
            }
        }