mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 05:02:36 +01:00
Color chooser - make brightness triangle blue
This commit is contained in:
parent
9683297e81
commit
66788c68e3
@ -508,9 +508,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this._tbHexCode.ReadOnly = true;
|
||||
this._tbHexCode.Size = new System.Drawing.Size(96, 22);
|
||||
this._tbHexCode.TabIndex = 58;
|
||||
this._tbHexCode.TextChanged += new System.EventHandler(this._tbHexCode_TextChanged);
|
||||
this._tbHexCode.Enter += new System.EventHandler(this._tbHexCode_Enter);
|
||||
this._tbHexCode.Leave += new System.EventHandler(this._tbHexCode_Leave);
|
||||
this._tbHexCode.TextChanged += new System.EventHandler(this.TextBoxHexCodeTextChanged);
|
||||
this._tbHexCode.Enter += new System.EventHandler(this.TextBoxHexCodeEnter);
|
||||
this._tbHexCode.Leave += new System.EventHandler(this.TextBoxHexCodeLeave);
|
||||
this._tbHexCode.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TbHexCodeMouseDown);
|
||||
this._tbHexCode.MouseUp += new System.Windows.Forms.MouseEventHandler(this._tbHexCode_MouseUp);
|
||||
//
|
||||
@ -943,7 +943,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void _tbHexCode_TextChanged(object sender, EventArgs e)
|
||||
private void TextBoxHexCodeTextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_hexEditOn)
|
||||
{
|
||||
@ -951,13 +951,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void _tbHexCode_Enter(object sender, EventArgs e)
|
||||
private void TextBoxHexCodeEnter(object sender, EventArgs e)
|
||||
{
|
||||
_hexEditOn = true;
|
||||
_tbHexCode.ReadOnly = false;
|
||||
}
|
||||
|
||||
private void _tbHexCode_Leave(object sender, EventArgs e)
|
||||
private void TextBoxHexCodeLeave(object sender, EventArgs e)
|
||||
{
|
||||
_hexEditOn = false;
|
||||
_tbHexCode.BackColor = UiUtil.BackColor;
|
||||
@ -1016,9 +1016,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
var c = panel.BackColor;
|
||||
UpdateRgb($"{c.A:x2}{c.R:x2}{c.G:x2}{c.B:x2}");
|
||||
_tbHexCode.TextChanged -= _tbHexCode_TextChanged;
|
||||
_tbHexCode.TextChanged -= TextBoxHexCodeTextChanged;
|
||||
ShowHexColorCode(new ColorHandler.Argb { Alpha = c.A, Red = c.R, Green = c.G, Blue = c.B });
|
||||
_tbHexCode.TextChanged += _tbHexCode_TextChanged;
|
||||
_tbHexCode.TextChanged += TextBoxHexCodeTextChanged;
|
||||
}
|
||||
|
||||
|
||||
|
@ -226,7 +226,7 @@ namespace Nikse.SubtitleEdit.Logic.ColorChooser
|
||||
case MouseState.DragInBrightness:
|
||||
// Calculate new color information
|
||||
// based on the brightness, which may have changed.
|
||||
Point newPoint = mousePoint;
|
||||
var newPoint = mousePoint;
|
||||
if (newPoint.Y < _brightnessMin)
|
||||
{
|
||||
newPoint.Y = _brightnessMin;
|
||||
@ -252,13 +252,13 @@ namespace Nikse.SubtitleEdit.Logic.ColorChooser
|
||||
// Calculate x and y distance from the center,
|
||||
// and then calculate the angle corresponding to the
|
||||
// new location.
|
||||
Point delta = new Point(mousePoint.X - _centerPoint.X, mousePoint.Y - _centerPoint.Y);
|
||||
int degrees = CalcDegrees(delta);
|
||||
var delta = new Point(mousePoint.X - _centerPoint.X, mousePoint.Y - _centerPoint.Y);
|
||||
var degrees = CalcDegrees(delta);
|
||||
|
||||
// Calculate distance from the center to the new point
|
||||
// as a fraction of the radius. Use your old friend,
|
||||
// the Pythagorean theorem, to calculate this value.
|
||||
double distance = Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y) / _radius;
|
||||
var distance = Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y) / _radius;
|
||||
|
||||
if (_currentState == MouseState.DragInColor)
|
||||
{
|
||||
@ -345,15 +345,17 @@ namespace Nikse.SubtitleEdit.Logic.ColorChooser
|
||||
_g.DrawImage(_colorImage, _colorRectangle);
|
||||
|
||||
// Draw the "selected color" rectangle.
|
||||
using (TextureBrush textureBrush = new TextureBrush(Resources.TransparentBackground))
|
||||
using (var textureBrush = new TextureBrush(Resources.TransparentBackground))
|
||||
{
|
||||
_g.FillRectangle(textureBrush, _selectedColorRectangle);
|
||||
}
|
||||
|
||||
_g.FillRectangle(selectedBrush, _selectedColorRectangle);
|
||||
_g.DrawRectangle(Pens.Black, _selectedColorRectangle);
|
||||
|
||||
// Draw the "brightness" rectangle.
|
||||
DrawLinearGradient(_fullColor);
|
||||
|
||||
// Draw the two pointers.
|
||||
DrawColorPointer(_colorPoint);
|
||||
DrawBrightnessPointer(_brightnessPoint);
|
||||
@ -531,7 +533,11 @@ namespace Nikse.SubtitleEdit.Logic.ColorChooser
|
||||
points[0] = pt;
|
||||
points[1] = new Point(pt.X + width, pt.Y + height / 2);
|
||||
points[2] = new Point(pt.X + width, pt.Y - height / 2);
|
||||
_g.FillPolygon(Brushes.Black, points);
|
||||
var color = Color.FromArgb(0, 120, 215);
|
||||
using (var brush = new SolidBrush(color))
|
||||
{
|
||||
_g.FillPolygon(brush, points);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
|
Loading…
Reference in New Issue
Block a user