public static void OpenScreenColorPicker(TaskSettings taskSettings = null) { if (taskSettings == null) { taskSettings = TaskSettings.GetDefaultTaskSettings(); } PointInfo pointInfo = RegionCaptureHelpers.GetPointInfo(); if (pointInfo != null) { string text = taskSettings.AdvancedSettings.ScreenColorPickerFormat; text = text.Replace("$r", pointInfo.Color.R.ToString(), StringComparison.InvariantCultureIgnoreCase). Replace("$g", pointInfo.Color.G.ToString(), StringComparison.InvariantCultureIgnoreCase). Replace("$b", pointInfo.Color.B.ToString(), StringComparison.InvariantCultureIgnoreCase). Replace("$hex", ColorHelpers.ColorToHex(pointInfo.Color), StringComparison.InvariantCultureIgnoreCase). Replace("$x", pointInfo.Position.X.ToString(), StringComparison.InvariantCultureIgnoreCase). Replace("$y", pointInfo.Position.Y.ToString(), StringComparison.InvariantCultureIgnoreCase); 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 { 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(); } }
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); } } }