public static PointInfo SelectPointColor(SurfaceOptions surfaceOptions = null) { if (surfaceOptions == null) { surfaceOptions = new SurfaceOptions(); } using (Image fullscreen = Screenshot.CaptureFullscreen()) using (RectangleRegion surface = new RectangleRegion(fullscreen)) { surface.Config = surfaceOptions; surface.OneClickMode = true; surface.Prepare(); surface.ShowDialog(); if (surface.Result == SurfaceResult.Region) { PointInfo pointInfo = new PointInfo(); pointInfo.Position = CaptureHelpers.ClientToScreen(surface.OneClickPosition); pointInfo.Color = ((Bitmap)fullscreen).GetPixel(surface.OneClickPosition.X, surface.OneClickPosition.Y); return pointInfo; } } return null; }
public static void OpenRuler() { using (Image fullscreen = Screenshot.CaptureFullscreen()) using (RectangleRegion surface = new RectangleRegion(fullscreen)) { surface.RulerMode = true; surface.Config.QuickCrop = false; surface.Config.ShowInfo = true; surface.Prepare(); surface.ShowDialog(); } }
public static bool SelectRegion(out Rectangle rect) { using (RectangleRegion surface = new RectangleRegion()) { surface.AreaManager.WindowCaptureMode = true; surface.AreaManager.IncludeControls = true; surface.Prepare(); surface.ShowDialog(); if (surface.Result == SurfaceResult.Region) { if (surface.AreaManager.IsCurrentAreaValid) { rect = CaptureHelpers.ClientToScreen(surface.AreaManager.CurrentArea); return true; } } else if (surface.Result == SurfaceResult.Fullscreen) { rect = CaptureHelpers.GetScreenBounds(); return true; } } rect = Rectangle.Empty; return false; }