private void captureScreen_Click(object sender, EventArgs e)
        {
            //* Test capture methods
            string timestamp = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");

            ScreenCapturer.CaptureWholeScreen(
                Path.Combine(Settings.Default.TempDirectory, "wholescreen-" + timestamp + ".jpg"));
            ScreenCapturer.CaptureCurrentWindow(
                Path.Combine(Settings.Default.TempDirectory, "currentwindow-" + timestamp + ".jpg"));
        }
Beispiel #2
0
 /// <summary>Capture the current (topmost) window to the given file.
 /// </summary>
 public static void CaptureCurrentWindow(string filename)
 {
     using (Bitmap bitmap = ScreenCapturer.CaptureCurrentWindow()) {
         try {
             bitmap.Save(filename, ImageFormat.Png);
         }
         catch (Exception) {
             //* Eat it
         }
     }
 }
        private void keyboard_ScreenPrintPress(object sender, PrtScnCatcher.ScreenPrintPressEventArgs e)
        {
            switch (e.Kind)
            {
            case PrtScnCatcher.ScreenPrintKind.Manual:
                ShowManualSelectionForm();
                break;

            case PrtScnCatcher.ScreenPrintKind.FullAuto:
                ScreenCapturer.CaptureWholeScreen(Utils.GetDefaultImageName());
                break;

            case PrtScnCatcher.ScreenPrintKind.TopWindowAuto:
                ScreenCapturer.CaptureCurrentWindow(Utils.GetDefaultImageName());
                break;
            }
        }