From b417d31c0c02097787526b0679421056881fb10f Mon Sep 17 00:00:00 2001 From: Jaex Date: Wed, 30 Nov 2016 16:01:12 +0300 Subject: [PATCH] Show color picker crosshair by default --- ShareX.HelpersLib/Colors/ColorBox.cs | 48 ++++---- ShareX.HelpersLib/Colors/ColorPicker.cs | 6 +- ShareX.HelpersLib/Colors/ColorPickerForm.cs | 2 +- ShareX.HelpersLib/Colors/ColorSlider.cs | 38 +++--- ShareX.HelpersLib/Colors/ColorUserControl.cs | 111 +++++++++--------- .../Shapes/Drawing/BaseDrawingShape.cs | 2 +- ShareX/Forms/ScreenColorPicker.cs | 1 - 7 files changed, 103 insertions(+), 105 deletions(-) diff --git a/ShareX.HelpersLib/Colors/ColorBox.cs b/ShareX.HelpersLib/Colors/ColorBox.cs index 359ba879f..6cc42de62 100644 --- a/ShareX.HelpersLib/Colors/ColorBox.cs +++ b/ShareX.HelpersLib/Colors/ColorBox.cs @@ -62,13 +62,13 @@ protected override void DrawHue() HSB start = new HSB(SelectedColor.HSB.Hue, 0.0, 0.0, SelectedColor.RGBA.Alpha); HSB end = new HSB(SelectedColor.HSB.Hue, 1.0, 0.0, SelectedColor.RGBA.Alpha); - for (int y = 0; y < ClientHeight; y++) + for (int y = 0; y < clientHeight; y++) { - start.Brightness = end.Brightness = 1.0 - (double)y / (ClientHeight - 1); + start.Brightness = end.Brightness = 1.0 - (double)y / (clientHeight - 1); - using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, ClientWidth, 1), start, end, LinearGradientMode.Horizontal)) + using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, clientWidth, 1), start, end, LinearGradientMode.Horizontal)) { - g.FillRectangle(brush, new Rectangle(0, y, ClientWidth, 1)); + g.FillRectangle(brush, new Rectangle(0, y, clientWidth, 1)); } } } @@ -83,13 +83,13 @@ protected override void DrawSaturation() HSB start = new HSB(0.0, SelectedColor.HSB.Saturation, 1.0, SelectedColor.RGBA.Alpha); HSB end = new HSB(0.0, SelectedColor.HSB.Saturation, 0.0, SelectedColor.RGBA.Alpha); - for (int x = 0; x < ClientWidth; x++) + for (int x = 0; x < clientWidth; x++) { - start.Hue = end.Hue = (double)x / (ClientHeight - 1); + start.Hue = end.Hue = (double)x / (clientHeight - 1); - using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, 1, ClientHeight), start, end, LinearGradientMode.Vertical)) + using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, 1, clientHeight), start, end, LinearGradientMode.Vertical)) { - g.FillRectangle(brush, new Rectangle(x, 0, 1, ClientHeight)); + g.FillRectangle(brush, new Rectangle(x, 0, 1, clientHeight)); } } } @@ -104,13 +104,13 @@ protected override void DrawBrightness() HSB start = new HSB(0.0, 1.0, SelectedColor.HSB.Brightness, SelectedColor.RGBA.Alpha); HSB end = new HSB(0.0, 0.0, SelectedColor.HSB.Brightness, SelectedColor.RGBA.Alpha); - for (int x = 0; x < ClientWidth; x++) + for (int x = 0; x < clientWidth; x++) { - start.Hue = end.Hue = (double)x / (ClientHeight - 1); + start.Hue = end.Hue = (double)x / (clientHeight - 1); - using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, 1, ClientHeight), start, end, LinearGradientMode.Vertical)) + using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, 1, clientHeight), start, end, LinearGradientMode.Vertical)) { - g.FillRectangle(brush, new Rectangle(x, 0, 1, ClientHeight)); + g.FillRectangle(brush, new Rectangle(x, 0, 1, clientHeight)); } } } @@ -125,13 +125,13 @@ protected override void DrawRed() RGBA start = new RGBA(SelectedColor.RGBA.Red, 0, 0, SelectedColor.RGBA.Alpha); RGBA end = new RGBA(SelectedColor.RGBA.Red, 0, 255, SelectedColor.RGBA.Alpha); - for (int y = 0; y < ClientHeight; y++) + for (int y = 0; y < clientHeight; y++) { - start.Green = end.Green = Round(255 - (255 * (double)y / (ClientHeight - 1))); + start.Green = end.Green = Round(255 - (255 * (double)y / (clientHeight - 1))); - using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, ClientWidth, 1), start, end, LinearGradientMode.Horizontal)) + using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, clientWidth, 1), start, end, LinearGradientMode.Horizontal)) { - g.FillRectangle(brush, new Rectangle(0, y, ClientWidth, 1)); + g.FillRectangle(brush, new Rectangle(0, y, clientWidth, 1)); } } } @@ -146,13 +146,13 @@ protected override void DrawGreen() RGBA start = new RGBA(0, SelectedColor.RGBA.Green, 0, SelectedColor.RGBA.Alpha); RGBA end = new RGBA(0, SelectedColor.RGBA.Green, 255, SelectedColor.RGBA.Alpha); - for (int y = 0; y < ClientHeight; y++) + for (int y = 0; y < clientHeight; y++) { - start.Red = end.Red = Round(255 - (255 * (double)y / (ClientHeight - 1))); + start.Red = end.Red = Round(255 - (255 * (double)y / (clientHeight - 1))); - using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, ClientWidth, 1), start, end, LinearGradientMode.Horizontal)) + using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, clientWidth, 1), start, end, LinearGradientMode.Horizontal)) { - g.FillRectangle(brush, new Rectangle(0, y, ClientWidth, 1)); + g.FillRectangle(brush, new Rectangle(0, y, clientWidth, 1)); } } } @@ -167,13 +167,13 @@ protected override void DrawBlue() RGBA start = new RGBA(0, 0, SelectedColor.RGBA.Blue, SelectedColor.RGBA.Alpha); RGBA end = new RGBA(255, 0, SelectedColor.RGBA.Blue, SelectedColor.RGBA.Alpha); - for (int y = 0; y < ClientHeight; y++) + for (int y = 0; y < clientHeight; y++) { - start.Green = end.Green = Round(255 - (255 * (double)y / (ClientHeight - 1))); + start.Green = end.Green = Round(255 - (255 * (double)y / (clientHeight - 1))); - using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, ClientWidth, 1), start, end, LinearGradientMode.Horizontal)) + using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, clientWidth, 1), start, end, LinearGradientMode.Horizontal)) { - g.FillRectangle(brush, new Rectangle(0, y, ClientWidth, 1)); + g.FillRectangle(brush, new Rectangle(0, y, clientWidth, 1)); } } } diff --git a/ShareX.HelpersLib/Colors/ColorPicker.cs b/ShareX.HelpersLib/Colors/ColorPicker.cs index 1ce169d64..4f6d5cf3d 100644 --- a/ShareX.HelpersLib/Colors/ColorPicker.cs +++ b/ShareX.HelpersLib/Colors/ColorPicker.cs @@ -72,12 +72,12 @@ public DrawStyle DrawStyle } } - public bool DrawCrosshair + public bool CrosshairVisible { set { - colorBox.drawCrosshair = value; - colorSlider.drawCrosshair = value; + colorBox.CrosshairVisible = value; + colorSlider.CrosshairVisible = value; } } diff --git a/ShareX.HelpersLib/Colors/ColorPickerForm.cs b/ShareX.HelpersLib/Colors/ColorPickerForm.cs index 4cf87df62..1d60fb611 100644 --- a/ShareX.HelpersLib/Colors/ColorPickerForm.cs +++ b/ShareX.HelpersLib/Colors/ColorPickerForm.cs @@ -67,7 +67,7 @@ public static Color GetColor(Color currentColor) public void SetCurrentColor(Color currentColor, bool keepPreviousColor) { oldColorExist = keepPreviousColor; - colorPicker.DrawCrosshair = lblOld.Visible = oldColorExist; + lblOld.Visible = oldColorExist; NewColor = OldColor = currentColor; colorPicker.ChangeColor(currentColor); nudAlpha.SetValue(currentColor.A); diff --git a/ShareX.HelpersLib/Colors/ColorSlider.cs b/ShareX.HelpersLib/Colors/ColorSlider.cs index 19ce31311..806f05d67 100644 --- a/ShareX.HelpersLib/Colors/ColorSlider.cs +++ b/ShareX.HelpersLib/Colors/ColorSlider.cs @@ -49,7 +49,7 @@ protected override void DrawCrosshair(Graphics g) private void DrawCrosshair(Graphics g, Pen pen, int offset, int height) { - g.DrawRectangleProper(pen, new Rectangle(offset, lastPos.Y - height / 2, ClientWidth - offset * 2, height)); + g.DrawRectangleProper(pen, new Rectangle(offset, lastPos.Y - height / 2, clientWidth - offset * 2, height)); } // Y = Hue 360 -> 0 @@ -59,13 +59,13 @@ protected override void DrawHue() { HSB color = new HSB(0.0, 1.0, 1.0, SelectedColor.RGBA.Alpha); - for (int y = 0; y < ClientHeight; y++) + for (int y = 0; y < clientHeight; y++) { - color.Hue = 1.0 - (double)y / (ClientHeight - 1); + color.Hue = 1.0 - (double)y / (clientHeight - 1); using (Pen pen = new Pen(color)) { - g.DrawLine(pen, 0, y, ClientWidth, y); + g.DrawLine(pen, 0, y, clientWidth, y); } } } @@ -78,13 +78,13 @@ protected override void DrawSaturation() { HSB color = new HSB(SelectedColor.HSB.Hue, 0.0, SelectedColor.HSB.Brightness, SelectedColor.RGBA.Alpha); - for (int y = 0; y < ClientHeight; y++) + for (int y = 0; y < clientHeight; y++) { - color.Saturation = 1.0 - (double)y / (ClientHeight - 1); + color.Saturation = 1.0 - (double)y / (clientHeight - 1); using (Pen pen = new Pen(color)) { - g.DrawLine(pen, 0, y, ClientWidth, y); + g.DrawLine(pen, 0, y, clientWidth, y); } } } @@ -97,13 +97,13 @@ protected override void DrawBrightness() { HSB color = new HSB(SelectedColor.HSB.Hue, SelectedColor.HSB.Saturation, 0.0, SelectedColor.RGBA.Alpha); - for (int y = 0; y < ClientHeight; y++) + for (int y = 0; y < clientHeight; y++) { - color.Brightness = 1.0 - (double)y / (ClientHeight - 1); + color.Brightness = 1.0 - (double)y / (clientHeight - 1); using (Pen pen = new Pen(color)) { - g.DrawLine(pen, 0, y, ClientWidth, y); + g.DrawLine(pen, 0, y, clientWidth, y); } } } @@ -116,13 +116,13 @@ protected override void DrawRed() { RGBA color = new RGBA(0, SelectedColor.RGBA.Green, SelectedColor.RGBA.Blue, SelectedColor.RGBA.Alpha); - for (int y = 0; y < ClientHeight; y++) + for (int y = 0; y < clientHeight; y++) { - color.Red = 255 - Round(255 * (double)y / (ClientHeight - 1)); + color.Red = 255 - Round(255 * (double)y / (clientHeight - 1)); using (Pen pen = new Pen(color)) { - g.DrawLine(pen, 0, y, ClientWidth, y); + g.DrawLine(pen, 0, y, clientWidth, y); } } } @@ -135,13 +135,13 @@ protected override void DrawGreen() { RGBA color = new RGBA(SelectedColor.RGBA.Red, 0, SelectedColor.RGBA.Blue, SelectedColor.RGBA.Alpha); - for (int y = 0; y < ClientHeight; y++) + for (int y = 0; y < clientHeight; y++) { - color.Green = 255 - Round(255 * (double)y / (ClientHeight - 1)); + color.Green = 255 - Round(255 * (double)y / (clientHeight - 1)); using (Pen pen = new Pen(color)) { - g.DrawLine(pen, 0, y, ClientWidth, y); + g.DrawLine(pen, 0, y, clientWidth, y); } } } @@ -154,13 +154,13 @@ protected override void DrawBlue() { RGBA color = new RGBA(SelectedColor.RGBA.Red, SelectedColor.RGBA.Green, 0, SelectedColor.RGBA.Alpha); - for (int y = 0; y < ClientHeight; y++) + for (int y = 0; y < clientHeight; y++) { - color.Blue = 255 - Round(255 * (double)y / (ClientHeight - 1)); + color.Blue = 255 - Round(255 * (double)y / (clientHeight - 1)); using (Pen pen = new Pen(color)) { - g.DrawLine(pen, 0, y, ClientWidth, y); + g.DrawLine(pen, 0, y, clientWidth, y); } } } diff --git a/ShareX.HelpersLib/Colors/ColorUserControl.cs b/ShareX.HelpersLib/Colors/ColorUserControl.cs index 8a19a1251..60a4ffa11 100644 --- a/ShareX.HelpersLib/Colors/ColorUserControl.cs +++ b/ShareX.HelpersLib/Colors/ColorUserControl.cs @@ -36,16 +36,7 @@ public abstract class ColorUserControl : UserControl { public event ColorEventHandler ColorChanged; - public bool drawCrosshair; - - protected Bitmap bmp; - protected int ClientWidth; - protected int ClientHeight; - protected DrawStyle drawStyle; - protected MyColor selectedColor; - protected bool mouseDown; - protected Point lastPos; - protected Timer mouseMoveTimer; + public bool CrosshairVisible { get; set; } = true; public MyColor SelectedColor { @@ -93,6 +84,14 @@ public DrawStyle DrawStyle } } + protected Bitmap bmp; + protected int clientWidth, clientHeight; + protected DrawStyle drawStyle; + protected MyColor selectedColor; + protected bool mouseDown; + protected Point lastPos; + protected Timer mouseMoveTimer; + #region Component Designer generated code private IContainer components = null; @@ -102,9 +101,9 @@ protected virtual void Initialize() SuspendLayout(); DoubleBuffered = true; - ClientWidth = this.ClientRectangle.Width; - ClientHeight = this.ClientRectangle.Height; - bmp = new Bitmap(ClientWidth, ClientHeight, PixelFormat.Format32bppArgb); + clientWidth = ClientRectangle.Width; + clientHeight = ClientRectangle.Height; + bmp = new Bitmap(clientWidth, clientHeight, PixelFormat.Format32bppArgb); SelectedColor = Color.Red; DrawStyle = DrawStyle.Hue; @@ -137,16 +136,16 @@ protected override void Dispose(bool disposing) private void EventClientSizeChanged(object sender, EventArgs e) { - ClientWidth = ClientRectangle.Width; - ClientHeight = ClientRectangle.Height; + clientWidth = ClientRectangle.Width; + clientHeight = ClientRectangle.Height; if (bmp != null) bmp.Dispose(); - bmp = new Bitmap(ClientWidth, ClientHeight, PixelFormat.Format32bppArgb); + bmp = new Bitmap(clientWidth, clientHeight, PixelFormat.Format32bppArgb); DrawColors(); } private void EventMouseDown(object sender, MouseEventArgs e) { - drawCrosshair = true; + CrosshairVisible = true; mouseDown = true; mouseMoveTimer.Start(); } @@ -174,7 +173,7 @@ private void EventPaint(object sender, PaintEventArgs e) if (SelectedColor.IsTransparent) { if (bmp != null) bmp.Dispose(); - bmp = (Bitmap)ImageHelpers.DrawCheckers(ClientWidth, ClientHeight); + bmp = (Bitmap)ImageHelpers.DrawCheckers(clientWidth, clientHeight); } DrawColors(); @@ -182,7 +181,7 @@ private void EventPaint(object sender, PaintEventArgs e) g.DrawImage(bmp, ClientRectangle); - if (drawCrosshair) + if (CrosshairVisible) { DrawCrosshair(g); } @@ -242,28 +241,28 @@ protected void SetBoxMarker() switch (DrawStyle) { case DrawStyle.Hue: - lastPos.X = Round((ClientWidth - 1) * SelectedColor.HSB.Saturation); - lastPos.Y = Round((ClientHeight - 1) * (1.0 - SelectedColor.HSB.Brightness)); + lastPos.X = Round((clientWidth - 1) * SelectedColor.HSB.Saturation); + lastPos.Y = Round((clientHeight - 1) * (1.0 - SelectedColor.HSB.Brightness)); break; case DrawStyle.Saturation: - lastPos.X = Round((ClientWidth - 1) * SelectedColor.HSB.Hue); - lastPos.Y = Round((ClientHeight - 1) * (1.0 - SelectedColor.HSB.Brightness)); + lastPos.X = Round((clientWidth - 1) * SelectedColor.HSB.Hue); + lastPos.Y = Round((clientHeight - 1) * (1.0 - SelectedColor.HSB.Brightness)); break; case DrawStyle.Brightness: - lastPos.X = Round((ClientWidth - 1) * SelectedColor.HSB.Hue); - lastPos.Y = Round((ClientHeight - 1) * (1.0 - SelectedColor.HSB.Saturation)); + lastPos.X = Round((clientWidth - 1) * SelectedColor.HSB.Hue); + lastPos.Y = Round((clientHeight - 1) * (1.0 - SelectedColor.HSB.Saturation)); break; case DrawStyle.Red: - lastPos.X = Round((ClientWidth - 1) * (double)SelectedColor.RGBA.Blue / 255); - lastPos.Y = Round((ClientHeight - 1) * (1.0 - (double)SelectedColor.RGBA.Green / 255)); + lastPos.X = Round((clientWidth - 1) * (double)SelectedColor.RGBA.Blue / 255); + lastPos.Y = Round((clientHeight - 1) * (1.0 - (double)SelectedColor.RGBA.Green / 255)); break; case DrawStyle.Green: - lastPos.X = Round((ClientWidth - 1) * (double)SelectedColor.RGBA.Blue / 255); - lastPos.Y = Round((ClientHeight - 1) * (1.0 - (double)SelectedColor.RGBA.Red / 255)); + lastPos.X = Round((clientWidth - 1) * (double)SelectedColor.RGBA.Blue / 255); + lastPos.Y = Round((clientHeight - 1) * (1.0 - (double)SelectedColor.RGBA.Red / 255)); break; case DrawStyle.Blue: - lastPos.X = Round((ClientWidth - 1) * (double)SelectedColor.RGBA.Red / 255); - lastPos.Y = Round((ClientHeight - 1) * (1.0 - (double)SelectedColor.RGBA.Green / 255)); + lastPos.X = Round((clientWidth - 1) * (double)SelectedColor.RGBA.Red / 255); + lastPos.Y = Round((clientHeight - 1) * (1.0 - (double)SelectedColor.RGBA.Green / 255)); break; } @@ -275,33 +274,33 @@ protected void GetBoxColor() switch (DrawStyle) { case DrawStyle.Hue: - selectedColor.HSB.Saturation = (double)lastPos.X / (ClientWidth - 1); - selectedColor.HSB.Brightness = 1.0 - (double)lastPos.Y / (ClientHeight - 1); + selectedColor.HSB.Saturation = (double)lastPos.X / (clientWidth - 1); + selectedColor.HSB.Brightness = 1.0 - (double)lastPos.Y / (clientHeight - 1); selectedColor.HSBUpdate(); break; case DrawStyle.Saturation: - selectedColor.HSB.Hue = (double)lastPos.X / (ClientWidth - 1); - selectedColor.HSB.Brightness = 1.0 - (double)lastPos.Y / (ClientHeight - 1); + selectedColor.HSB.Hue = (double)lastPos.X / (clientWidth - 1); + selectedColor.HSB.Brightness = 1.0 - (double)lastPos.Y / (clientHeight - 1); selectedColor.HSBUpdate(); break; case DrawStyle.Brightness: - selectedColor.HSB.Hue = (double)lastPos.X / (ClientWidth - 1); - selectedColor.HSB.Saturation = 1.0 - (double)lastPos.Y / (ClientHeight - 1); + selectedColor.HSB.Hue = (double)lastPos.X / (clientWidth - 1); + selectedColor.HSB.Saturation = 1.0 - (double)lastPos.Y / (clientHeight - 1); selectedColor.HSBUpdate(); break; case DrawStyle.Red: - selectedColor.RGBA.Blue = Round(255 * (double)lastPos.X / (ClientWidth - 1)); - selectedColor.RGBA.Green = Round(255 * (1.0 - (double)lastPos.Y / (ClientHeight - 1))); + selectedColor.RGBA.Blue = Round(255 * (double)lastPos.X / (clientWidth - 1)); + selectedColor.RGBA.Green = Round(255 * (1.0 - (double)lastPos.Y / (clientHeight - 1))); selectedColor.RGBAUpdate(); break; case DrawStyle.Green: - selectedColor.RGBA.Blue = Round(255 * (double)lastPos.X / (ClientWidth - 1)); - selectedColor.RGBA.Red = Round(255 * (1.0 - (double)lastPos.Y / (ClientHeight - 1))); + selectedColor.RGBA.Blue = Round(255 * (double)lastPos.X / (clientWidth - 1)); + selectedColor.RGBA.Red = Round(255 * (1.0 - (double)lastPos.Y / (clientHeight - 1))); selectedColor.RGBAUpdate(); break; case DrawStyle.Blue: - selectedColor.RGBA.Red = Round(255 * (double)lastPos.X / (ClientWidth - 1)); - selectedColor.RGBA.Green = Round(255 * (1.0 - (double)lastPos.Y / (ClientHeight - 1))); + selectedColor.RGBA.Red = Round(255 * (double)lastPos.X / (clientWidth - 1)); + selectedColor.RGBA.Green = Round(255 * (1.0 - (double)lastPos.Y / (clientHeight - 1))); selectedColor.RGBAUpdate(); break; } @@ -312,22 +311,22 @@ protected void SetSliderMarker() switch (DrawStyle) { case DrawStyle.Hue: - lastPos.Y = (ClientHeight - 1) - Round((ClientHeight - 1) * SelectedColor.HSB.Hue); + lastPos.Y = (clientHeight - 1) - Round((clientHeight - 1) * SelectedColor.HSB.Hue); break; case DrawStyle.Saturation: - lastPos.Y = (ClientHeight - 1) - Round((ClientHeight - 1) * SelectedColor.HSB.Saturation); + lastPos.Y = (clientHeight - 1) - Round((clientHeight - 1) * SelectedColor.HSB.Saturation); break; case DrawStyle.Brightness: - lastPos.Y = (ClientHeight - 1) - Round((ClientHeight - 1) * SelectedColor.HSB.Brightness); + lastPos.Y = (clientHeight - 1) - Round((clientHeight - 1) * SelectedColor.HSB.Brightness); break; case DrawStyle.Red: - lastPos.Y = (ClientHeight - 1) - Round((ClientHeight - 1) * (double)SelectedColor.RGBA.Red / 255); + lastPos.Y = (clientHeight - 1) - Round((clientHeight - 1) * (double)SelectedColor.RGBA.Red / 255); break; case DrawStyle.Green: - lastPos.Y = (ClientHeight - 1) - Round((ClientHeight - 1) * (double)SelectedColor.RGBA.Green / 255); + lastPos.Y = (clientHeight - 1) - Round((clientHeight - 1) * (double)SelectedColor.RGBA.Green / 255); break; case DrawStyle.Blue: - lastPos.Y = (ClientHeight - 1) - Round((ClientHeight - 1) * (double)SelectedColor.RGBA.Blue / 255); + lastPos.Y = (clientHeight - 1) - Round((clientHeight - 1) * (double)SelectedColor.RGBA.Blue / 255); break; } lastPos = GetPoint(lastPos); @@ -338,27 +337,27 @@ protected void GetSliderColor() switch (DrawStyle) { case DrawStyle.Hue: - selectedColor.HSB.Hue = 1.0 - (double)lastPos.Y / (ClientHeight - 1); + selectedColor.HSB.Hue = 1.0 - (double)lastPos.Y / (clientHeight - 1); selectedColor.HSBUpdate(); break; case DrawStyle.Saturation: - selectedColor.HSB.Saturation = 1.0 - (double)lastPos.Y / (ClientHeight - 1); + selectedColor.HSB.Saturation = 1.0 - (double)lastPos.Y / (clientHeight - 1); selectedColor.HSBUpdate(); break; case DrawStyle.Brightness: - selectedColor.HSB.Brightness = 1.0 - (double)lastPos.Y / (ClientHeight - 1); + selectedColor.HSB.Brightness = 1.0 - (double)lastPos.Y / (clientHeight - 1); selectedColor.HSBUpdate(); break; case DrawStyle.Red: - selectedColor.RGBA.Red = 255 - Round(255 * (double)lastPos.Y / (ClientHeight - 1)); + selectedColor.RGBA.Red = 255 - Round(255 * (double)lastPos.Y / (clientHeight - 1)); selectedColor.RGBAUpdate(); break; case DrawStyle.Green: - selectedColor.RGBA.Green = 255 - Round(255 * (double)lastPos.Y / (ClientHeight - 1)); + selectedColor.RGBA.Green = 255 - Round(255 * (double)lastPos.Y / (clientHeight - 1)); selectedColor.RGBAUpdate(); break; case DrawStyle.Blue: - selectedColor.RGBA.Blue = 255 - Round(255 * (double)lastPos.Y / (ClientHeight - 1)); + selectedColor.RGBA.Blue = 255 - Round(255 * (double)lastPos.Y / (clientHeight - 1)); selectedColor.RGBAUpdate(); break; } @@ -397,7 +396,7 @@ protected void GetPointColor(Point point) protected Point GetPoint(Point point) { - return new Point(point.X.Between(0, ClientWidth - 1), point.Y.Between(0, ClientHeight - 1)); + return new Point(point.X.Between(0, clientWidth - 1), point.Y.Between(0, clientHeight - 1)); } protected int Round(double val) diff --git a/ShareX.ScreenCaptureLib/Shapes/Drawing/BaseDrawingShape.cs b/ShareX.ScreenCaptureLib/Shapes/Drawing/BaseDrawingShape.cs index 1cc93823d..7d39c621d 100644 --- a/ShareX.ScreenCaptureLib/Shapes/Drawing/BaseDrawingShape.cs +++ b/ShareX.ScreenCaptureLib/Shapes/Drawing/BaseDrawingShape.cs @@ -35,7 +35,7 @@ public abstract class BaseDrawingShape : BaseShape public int BorderSize { get; set; } public Color FillColor { get; set; } - public bool Shadow { get; set; } = true; + public bool Shadow { get; set; } public Color ShadowColor { get; set; } = Color.FromArgb(125, 0, 0, 0); public Point ShadowOffset { get; set; } = new Point(0, 1); diff --git a/ShareX/Forms/ScreenColorPicker.cs b/ShareX/Forms/ScreenColorPicker.cs index c8ef1c304..b989c8ccf 100644 --- a/ShareX/Forms/ScreenColorPicker.cs +++ b/ShareX/Forms/ScreenColorPicker.cs @@ -43,7 +43,6 @@ public ScreenColorPicker() InitializeComponent(); btnOK.Visible = false; btnCancel.Text = Resources.ScreenColorPicker_ScreenColorPicker_Close; - colorPicker.DrawCrosshair = true; colorTimer.Tick += colorTimer_Tick; UpdateControls(false);