Esempio n. 1
0
        bool OnlySelectionRectangle; // If we don't need to perform any action to the cropped image

        #endregion

        #region CropForm show

        /// <summary>
        /// Shows the crop form and returns the cropped rectangle
        /// </summary>
        /// <param name="screenshot">The original screenshot</param>
        /// <returns>The cropped rectangle</returns>
        public static Rectangle ShowRectangle(Bitmap screenshot)
        {
            using (var cf = new CropForm(screenshot, true))
            {
                cf.ShowDialog();
                GC.Collect();
                return(cf.CroppedRectangle);
            }
        }
Esempio n. 2
0
        void Gkh_KeyDown(object sender, KeyEventArgs e)
        {
            Thread.Sleep(Settings.GetValue <int>("delay"));
            bool captureCursor = Settings.GetValue <bool>("captureCursor");

            if (!e.Shift) // Screenshot
            {
                if (e.Control)
                {
                    ActionForm.PerformAction(Screenshot.CaptureScreen(captureCursor));
                }
                else if (e.Alt)
                {
                    ActionForm.PerformAction(Screenshot.CaptureActiveWindow(captureCursor));
                }
                else
                {
                    new CropForm(Screenshot.CaptureScreen(captureCursor)).Show();
                }
            }
            else // Gif capture
            {
                if (e.Control)
                {
                    new GifForm(captureCursor, Screen.PrimaryScreen.Bounds).Show();
                }
                else if (e.Alt)
                {
                    new GifForm(captureCursor, Screenshot.GetActiveWindowRect()).Show();
                }
                else
                {
                    var rectangle = CropForm.ShowRectangle(Screenshot.CaptureScreen(captureCursor));
                    if (rectangle.Width > 0 && rectangle.Height > 0)
                    {
                        new GifForm(captureCursor, rectangle).Show();
                    }
                }
            }
        }