Example #1
0
        public static PointInfo SelectPointColor()
        {
            using (RectangleRegion surface = new RectangleRegion())
            {
                surface.OneClickMode = true;
                surface.Prepare();
                surface.ShowDialog();

                if (surface.Result == SurfaceResult.Region)
                {
                    PointInfo pointInfo = new PointInfo();
                    pointInfo.Position = CaptureHelpers.ClientToScreen(surface.CurrentPosition);
                    pointInfo.Color    = surface.CurrentColor;
                    return(pointInfo);
                }
            }

            return(null);
        }
Example #2
0
        public static void OpenScreenColorPicker(TaskSettings taskSettings = null)
        {
            if (taskSettings == null)
            {
                taskSettings = TaskSettings.GetDefaultTaskSettings();
            }

            PointInfo pointInfo = RegionCaptureTasks.GetPointInfo(taskSettings.CaptureSettings.SurfaceOptions);

            if (pointInfo != null)
            {
                string text = CodeMenuEntryPixelInfo.Parse(taskSettings.ToolsSettings.ScreenColorPickerFormat, pointInfo.Color, pointInfo.Position);

                ClipboardHelpers.CopyText(text);

                if (!taskSettings.AdvancedSettings.DisableNotifications && taskSettings.GeneralSettings.PopUpNotification != PopUpNotificationType.None)
                {
                    //ShowBalloonTip(string.Format(Resources.TaskHelpers_OpenQuickScreenColorPicker_Copied_to_clipboard___0_, text), ToolTipIcon.Info, 3000);
                }
            }
        }
Example #3
0
        private void btnPipette_Click(object sender, EventArgs e)
        {
            try
            {
                SetCurrentColor(NewColor);
                UpdateControls(false);

                Hide();
                Thread.Sleep(250);

                PointInfo pointInfo = TaskHelpers.SelectPointColor();

                if (pointInfo != null)
                {
                    UpdateColor(pointInfo.Position.X, pointInfo.Position.Y, pointInfo.Color);
                }
            }
            finally
            {
                this.ShowActivate();
            }
        }
Example #4
0
        private void btnPipette_Click(object sender, EventArgs e)
        {
            try
            {
                SetCurrentColor(NewColor, true);
                UpdateControls(false);

                Hide();
                Thread.Sleep(250);

                PointInfo pointInfo = RegionCaptureHelpers.GetPointInfo();

                if (pointInfo != null)
                {
                    UpdateColor(pointInfo.Position.X, pointInfo.Position.Y, pointInfo.Color);
                }
            }
            finally
            {
                this.ForceActivate();
            }
        }
Example #5
0
        public static void OpenScreenColorPicker(TaskSettings taskSettings = null)
        {
            if (taskSettings == null)
            {
                taskSettings = TaskSettings.GetDefaultTaskSettings();
            }

            PointInfo pointInfo = RegionCaptureHelpers.GetPointInfo(taskSettings.CaptureSettings.SurfaceOptions);

            if (pointInfo != null)
            {
                string text = CodeMenuEntryPixelInfo.Parse(taskSettings.ToolsSettings.ScreenColorPickerFormat, pointInfo.Color, pointInfo.Position);

                ClipboardHelpers.CopyText(text);

                if (Program.MainForm.niTray.Visible)
                {
                    Program.MainForm.niTray.Tag = null;
                    Program.MainForm.niTray.ShowBalloonTip(3000, "ShareX", string.Format(Resources.TaskHelpers_OpenQuickScreenColorPicker_Copied_to_clipboard___0_, text), ToolTipIcon.Info);
                }
            }
        }
        private void btnPipette_Click(object sender, EventArgs e)
        {
            try
            {
                colorTimer.Enabled = false;
                UpdateColorPickerButtonText();

                Hide();
                Thread.Sleep(100);

                PointInfo pointInfo = TaskHelpers.SelectPointColor(surfaceOptions);

                if (pointInfo != null)
                {
                    UpdateColor(pointInfo.Position.X, pointInfo.Position.Y, pointInfo.Color);
                }
            }
            finally
            {
                this.ShowActivate();
            }
        }
Example #7
0
        public static PointInfo SelectPointColor()
        {
            using (RectangleRegion surface = new RectangleRegion())
            {
                surface.ScreenColorPickerMode = true;
                surface.Config.UseDimming     = false;
                surface.Config.ShowInfo       = true;
                surface.Config.ShowMagnifier  = true;
                surface.Config.ShowTips       = false;
                surface.Prepare();
                surface.ShowDialog();

                if (surface.Result == SurfaceResult.Region)
                {
                    PointInfo pointInfo = new PointInfo();
                    pointInfo.Position = surface.CurrentPosition;
                    pointInfo.Color    = surface.CurrentColor;
                    return(pointInfo);
                }
            }

            return(null);
        }
        private void btnPipette_Click(object sender, EventArgs e)
        {
            try
            {
                SetCurrentColor(NewColor, true);
                UpdateControls(false);

                Hide();
                Thread.Sleep(250);

                TaskSettings taskSettings = TaskSettings.GetDefaultTaskSettings();
                PointInfo    pointInfo    = RegionCaptureTasks.GetPointInfo(taskSettings.CaptureSettings.SurfaceOptions);

                if (pointInfo != null)
                {
                    UpdateColor(pointInfo.Position.X, pointInfo.Position.Y, pointInfo.Color);
                }
            }
            finally
            {
                this.ForceActivate();
            }
        }
Example #9
0
        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;
        }