public static Image GetRegionImage(RegionCaptureOptions options) { using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Default)) { form.Config = GetRegionCaptureOptions(options); form.Config.ShowTips = false; form.Prepare(); form.ShowDialog(); return form.GetResultImage(); } }
public static bool GetRectangleRegion(out Rectangle rect, RegionCaptureOptions options) { RegionCaptureOptions newOptions = GetRegionCaptureOptions(options); newOptions.ShowHotkeys = false; using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Default, newOptions)) { form.ShowDialog(); if (form.Result == RegionResult.Region) { if (form.ShapeManager.IsCurrentShapeValid) { rect = CaptureHelpers.ClientToScreen(form.ShapeManager.CurrentRectangle); return(true); } } else if (form.Result == RegionResult.Fullscreen) { rect = CaptureHelpers.GetScreenBounds(); return(true); } else if (form.Result == RegionResult.Monitor) { Screen[] screens = Screen.AllScreens; if (form.MonitorIndex < screens.Length) { Screen screen = screens[form.MonitorIndex]; rect = screen.Bounds; return(true); } } else if (form.Result == RegionResult.ActiveMonitor) { rect = CaptureHelpers.GetActiveScreenBounds(); return(true); } } rect = Rectangle.Empty; return(false); }
public static bool GetRectangleRegion(out Rectangle rect, RegionCaptureOptions options) { using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Default)) { form.Config = GetRegionCaptureOptions(options); form.Config.ShowTips = false; form.Prepare(); form.ShowDialog(); if (form.Result == RegionResult.Region) { if (form.ShapeManager.IsCurrentShapeValid) { rect = CaptureHelpers.ClientToScreen(form.ShapeManager.CurrentRectangle); return true; } } else if (form.Result == RegionResult.Fullscreen) { rect = CaptureHelpers.GetScreenBounds(); return true; } else if (form.Result == RegionResult.Monitor) { Screen[] screens = Screen.AllScreens; if (form.MonitorIndex < screens.Length) { Screen screen = screens[form.MonitorIndex]; rect = screen.Bounds; return true; } } else if (form.Result == RegionResult.ActiveMonitor) { rect = CaptureHelpers.GetActiveScreenBounds(); return true; } } rect = Rectangle.Empty; return false; }
public static SimpleWindowInfo GetWindowInfo(RegionCaptureOptions options) { RegionCaptureOptions newOptions = GetRegionCaptureOptions(options); newOptions.UseDimming = false; newOptions.ShowMagnifier = false; using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.OneClick, newOptions)) { form.ShowDialog(); if (form.Result == RegionResult.Region) { return(form.SelectedWindow); } } return(null); }
public ShapeManager(RegionCaptureForm form) { Form = form; Options = form.Options; DrawableObjects = new List <DrawableObject>(); ResizeNodes = new ResizeNode[9]; for (int i = 0; i < ResizeNodes.Length; i++) { ResizeNode node = new ResizeNode(); node.SetCustomNode(form.CustomNodeImage); DrawableObjects.Add(node); ResizeNodes[i] = node; } ResizeNodes[(int)NodePosition.BottomRight].Order = 10; form.Shown += form_Shown; form.LostFocus += form_LostFocus; form.MouseDown += form_MouseDown; form.MouseUp += form_MouseUp; form.MouseDoubleClick += form_MouseDoubleClick; form.MouseWheel += form_MouseWheel; form.KeyDown += form_KeyDown; form.KeyUp += form_KeyUp; CurrentShape = null; if (form.Mode == RegionCaptureMode.Annotation) { CurrentTool = Options.LastRegionTool; } else if (form.IsEditorMode) { CurrentTool = Options.LastEditorTool; } else { CurrentTool = ShapeType.RegionRectangle; } }
public static Image AnnotateImage(Image img, RegionCaptureOptions options) { using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Editor)) { form.Config = GetRegionCaptureOptions(options); form.Config.DetectWindows = false; form.Config.ShowTips = false; form.Config.UseDimming = false; form.Prepare(img); form.ShowDialog(); if (form.Result == RegionResult.Region) { return(form.GetResultImage()); } } return(null); }
public static SimpleWindowInfo GetWindowInfo(RegionCaptureOptions options) { using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.OneClick)) { form.Config = GetRegionCaptureOptions(options); form.Config.UseDimming = false; form.Config.ShowMagnifier = false; form.Config.ShowTips = false; form.Prepare(); form.ShowDialog(); if (form.Result == RegionResult.Region) { return(form.SelectedWindow); } } return(null); }
public ShapeManager(RegionCaptureForm form) { this.form = form; Config = form.Config; ResizeNodes = new List <ResizeNode>(); for (int i = 0; i < 9; i++) { ResizeNode node = new ResizeNode(); node.SetCustomNode(form.CustomNodeImage); form.DrawableObjects.Add(node); ResizeNodes.Add(node); } ResizeNodes[(int)NodePosition.BottomRight].Order = 10; form.Shown += form_Shown; form.LostFocus += form_LostFocus; form.MouseDown += form_MouseDown; form.MouseUp += form_MouseUp; form.MouseDoubleClick += form_MouseDoubleClick; form.MouseWheel += form_MouseWheel; form.KeyDown += form_KeyDown; form.KeyUp += form_KeyUp; CurrentShape = null; if (form.Mode == RegionCaptureMode.Annotation) { CurrentShapeType = Config.LastRegionTool; } else if (form.IsEditorMode) { CurrentShapeType = Config.LastAnnotationTool; } else { CurrentShapeType = ShapeType.RegionRectangle; } }
public static PointInfo GetPointInfo(RegionCaptureOptions options, Bitmap canvas = null) { RegionCaptureOptions newOptions = GetRegionCaptureOptions(options); newOptions.DetectWindows = false; newOptions.UseDimming = false; using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.ScreenColorPicker, newOptions, canvas)) { form.ShowDialog(); if (form.Result == RegionResult.Region) { PointInfo pointInfo = new PointInfo(); pointInfo.Position = form.CurrentPosition; pointInfo.Color = form.ShapeManager.GetCurrentColor(); return(pointInfo); } } return(null); }
public static PointInfo GetPointInfo(RegionCaptureOptions options) { using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.ScreenColorPicker)) { form.Config = GetRegionCaptureOptions(options); form.Config.DetectWindows = false; form.Config.ShowTips = false; form.Config.UseDimming = false; form.Prepare(); form.ShowDialog(); if (form.Result == RegionResult.Region) { PointInfo pointInfo = new PointInfo(); pointInfo.Position = form.CurrentPosition; pointInfo.Color = form.CurrentColor; return(pointInfo); } } return(null); }
public static void AnnotateImage(Image img, string filePath, RegionCaptureOptions options, Action<Image> afterCaptureTasksRequested, Action<Image, string> saveImageRequested, Action<Image, string> saveImageAsRequested, Action<Image> copyImageRequested, Action<Image> uploadImageRequested, Action<Image> printImageRequested) { using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Editor)) { form.ImageFilePath = filePath; form.Config = GetRegionCaptureOptions(options); form.Config.DetectWindows = false; form.Config.ShowTips = false; form.Config.UseDimming = false; form.Prepare(img); form.ShowDialog(); if (form.Result != RegionResult.Close) { Image result = form.GetResultImage(); switch (form.Result) { default: result.Dispose(); break; case RegionResult.AnnotateRunAfterCaptureTasks: afterCaptureTasksRequested(result); break; case RegionResult.AnnotateSaveImage: saveImageRequested(result, form.ImageFilePath); result.Dispose(); break; case RegionResult.AnnotateSaveImageAs: saveImageAsRequested(result, form.ImageFilePath); result.Dispose(); break; case RegionResult.AnnotateCopyImage: copyImageRequested(result); result.Dispose(); break; case RegionResult.AnnotateUploadImage: uploadImageRequested(result); break; case RegionResult.AnnotatePrintImage: printImageRequested(result); result.Dispose(); break; } } } }
public ImageEditorScrollbar(Orientation orientation, RegionCaptureForm form) { Orientation = orientation; this.form = form; }
public static void AnnotateImage(Image img, string filePath, RegionCaptureOptions options, Action <Image> afterCaptureTasksRequested, Action <Image, string> saveImageRequested, Action <Image, string> saveImageAsRequested, Action <Image> copyImageRequested, Action <Image> uploadImageRequested, Action <Image> printImageRequested) { using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Editor)) { form.ImageFilePath = filePath; form.Config = GetRegionCaptureOptions(options); form.Config.DetectWindows = false; form.Config.ShowTips = false; form.Config.UseDimming = false; form.Prepare(img); form.ShowDialog(); if (form.Result != RegionResult.Close) { Image result = form.GetResultImage(); switch (form.Result) { default: result.Dispose(); break; case RegionResult.AnnotateRunAfterCaptureTasks: afterCaptureTasksRequested(result); break; case RegionResult.AnnotateSaveImage: saveImageRequested(result, form.ImageFilePath); result.Dispose(); break; case RegionResult.AnnotateSaveImageAs: saveImageAsRequested(result, form.ImageFilePath); result.Dispose(); break; case RegionResult.AnnotateCopyImage: copyImageRequested(result); result.Dispose(); break; case RegionResult.AnnotateUploadImage: uploadImageRequested(result); break; case RegionResult.AnnotatePrintImage: printImageRequested(result); result.Dispose(); break; } } } }
public static void CaptureRegion(TaskSettings taskSettings, bool autoHideForm = true) { RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Annotation); DoCapture(() => { Image img = null; try { form.Config = taskSettings.CaptureSettingsReference.SurfaceOptions; form.Prepare(TaskHelpers.GetScreenshot(taskSettings).CaptureFullscreen()); form.ShowDialog(); img = form.GetResultImage(); if (img != null) { if (form.Result == RegionResult.Region && taskSettings.UploadSettings.RegionCaptureUseWindowPattern) { WindowInfo windowInfo = form.GetWindowInfo(); if (windowInfo != null) { img.Tag = new ImageTag { WindowTitle = windowInfo.Text, ProcessName = windowInfo.ProcessName }; } } lastRegionCaptureType = LastRegionCaptureType.Default; } } finally { if (form != null) { form.Dispose(); } } return img; }, CaptureType.Region, taskSettings, autoHideForm); }
public static PointInfo GetPointInfo(RegionCaptureOptions options) { using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.ScreenColorPicker)) { form.Config = GetRegionCaptureOptions(options); form.Config.DetectWindows = false; form.Config.ShowTips = false; form.Config.UseDimming = false; form.Prepare(); form.ShowDialog(); if (form.Result == RegionResult.Region) { PointInfo pointInfo = new PointInfo(); pointInfo.Position = form.CurrentPosition; pointInfo.Color = form.CurrentColor; return pointInfo; } } return null; }
public ShapeManager(RegionCaptureForm form) { this.form = form; Config = form.Config; ResizeNodes = new List<ResizeNode>(); for (int i = 0; i < 9; i++) { ResizeNode node = new ResizeNode(); form.DrawableObjects.Add(node); ResizeNodes.Add(node); } ResizeNodes[(int)NodePosition.BottomRight].Order = 10; form.Shown += form_Shown; form.LostFocus += form_LostFocus; form.MouseDown += form_MouseDown; form.MouseUp += form_MouseUp; form.MouseDoubleClick += form_MouseDoubleClick; form.MouseWheel += form_MouseWheel; form.KeyDown += form_KeyDown; form.KeyUp += form_KeyUp; CurrentShape = null; if (form.Mode == RegionCaptureMode.Annotation) { CurrentShapeType = Config.LastRegionTool; } else if (form.Mode == RegionCaptureMode.Editor) { CurrentShapeType = Config.LastAnnotationTool; } else { CurrentShapeType = ShapeType.RegionRectangle; } }
public static SimpleWindowInfo GetWindowInfo(RegionCaptureOptions options) { using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.OneClick)) { form.Config = GetRegionCaptureOptions(options); form.Config.UseDimming = false; form.Config.ShowMagnifier = false; form.Config.ShowTips = false; form.Prepare(); form.ShowDialog(); if (form.Result == RegionResult.Region) { return form.SelectedWindow; } } return null; }
public static void ShowScreenRuler(RegionCaptureOptions options) { using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.Ruler)) { form.Config = GetRegionCaptureOptions(options); form.Config.QuickCrop = false; form.Config.ShowTips = false; form.Prepare(); form.ShowDialog(); } }
public static Image AnnotateImage(Image img, string filePath, RegionCaptureOptions options, Action <Image, string> saveImageRequested, Action <Image, string> saveImageAsRequested, Action <Image> copyImageRequested, Action <Image> uploadImageRequested, Action <Image> printImageRequested, bool taskMode = false) { RegionCaptureMode mode = taskMode ? RegionCaptureMode.TaskEditor : RegionCaptureMode.Editor; using (RegionCaptureForm form = new RegionCaptureForm(mode, options)) { form.ImageFilePath = filePath; form.Prepare(img); form.ShowDialog(); switch (form.Result) { case RegionResult.Close: // Esc case RegionResult.AnnotateCancelTask: return(null); case RegionResult.Region: // Enter case RegionResult.AnnotateRunAfterCaptureTasks: return(form.GetResultImage()); case RegionResult.Fullscreen: // Space or right click case RegionResult.AnnotateContinueTask: return((Image)form.Image.Clone()); case RegionResult.AnnotateSaveImage: using (Image resultSaveImage = form.GetResultImage()) { saveImageRequested(resultSaveImage, form.ImageFilePath); } break; case RegionResult.AnnotateSaveImageAs: using (Image resultSaveImageAs = form.GetResultImage()) { saveImageAsRequested(resultSaveImageAs, form.ImageFilePath); } break; case RegionResult.AnnotateCopyImage: using (Image resultCopyImage = form.GetResultImage()) { copyImageRequested(resultCopyImage); } break; case RegionResult.AnnotateUploadImage: Image resultUploadImage = form.GetResultImage(); uploadImageRequested(resultUploadImage); break; case RegionResult.AnnotatePrintImage: using (Image resultPrintImage = form.GetResultImage()) { printImageRequested(resultPrintImage); } break; } } return(null); }
public static Image AnnotateImage(Image img, string filePath, RegionCaptureOptions options, Action <Image, string> saveImageRequested, Action <Image, string> saveImageAsRequested, Action <Image> copyImageRequested, Action <Image> uploadImageRequested, Action <Image> printImageRequested) { using (RegionCaptureForm form = new RegionCaptureForm(RegionCaptureMode.TaskEditor)) { form.ImageFilePath = filePath; form.Config = GetRegionCaptureOptions(options); form.Config.DetectWindows = false; form.Config.ShowHotkeys = false; form.Config.UseDimming = false; form.Prepare(img); form.ShowDialog(); switch (form.Result) { case RegionResult.Close: // Esc case RegionResult.AnnotateCancelTask: return(null); case RegionResult.Region: // Enter case RegionResult.AnnotateRunAfterCaptureTasks: return(form.GetResultImage()); case RegionResult.Fullscreen: // Space case RegionResult.AnnotateContinueTask: return((Image)img.Clone()); case RegionResult.AnnotateSaveImage: using (Image resultSaveImage = form.GetResultImage()) { saveImageRequested(resultSaveImage, form.ImageFilePath); } break; case RegionResult.AnnotateSaveImageAs: using (Image resultSaveImageAs = form.GetResultImage()) { saveImageAsRequested(resultSaveImageAs, form.ImageFilePath); } break; case RegionResult.AnnotateCopyImage: using (Image resultCopyImage = form.GetResultImage()) { copyImageRequested(resultCopyImage); } break; case RegionResult.AnnotateUploadImage: Image resultUploadImage = form.GetResultImage(); uploadImageRequested(resultUploadImage); break; case RegionResult.AnnotatePrintImage: using (Image resultPrintImage = form.GetResultImage()) { printImageRequested(resultPrintImage); } break; } } return(null); }