Exemplo n.º 1
0
        public static PointInfo SelectPointColor(SurfaceOptions surfaceOptions = null)
        {
            if (surfaceOptions == null)
            {
                surfaceOptions = new SurfaceOptions();
            }

            using (Image fullscreen = new CaptureFullScreen().Screenshot())
                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);
        }
Exemplo n.º 2
0
 public static void OpenRuler()
 {
     using (Image fullscreen = new CaptureFullScreen().Screenshot())
         using (RectangleRegion surface = new RectangleRegion(fullscreen))
         {
             surface.RulerMode               = true;
             surface.Config.QuickCrop        = false;
             surface.Config.ShowInfo         = true;
             surface.AreaManager.MinimumSize = 3;
             surface.Prepare();
             surface.ShowDialog();
         }
 }