/src/ColorsForm.cs
C# | 1986 lines | 1579 code | 246 blank | 161 comment | 127 complexity | 5d339fe38fe66f6437f439a9a23d2443 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- /////////////////////////////////////////////////////////////////////////////////
- // Paint.NET //
- // Copyright (C) dotPDN LLC, Rick Brewster, Tom Jackson, and contributors. //
- // Portions Copyright (C) Microsoft Corporation. All Rights Reserved. //
- // See src/Resources/Files/License.txt for full licensing and attribution //
- // details. //
- // . //
- /////////////////////////////////////////////////////////////////////////////////
-
- using PaintDotNet.Base;
- using PaintDotNet.SystemLayer;
- using System;
- using System.Drawing;
- using System.Drawing.Imaging;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Windows.Forms;
-
- namespace PaintDotNet
- {
- // TODO: rewrite this ... the code is out of control here as it has grown organically,
- // and it's impossible to maintain. post-3.0
- internal class ColorsForm
- : FloatingToolForm
- {
- // We want some buttons that don't have a gradient background or fancy border
- private sealed class OurToolStripRenderer
- : ToolStripProfessionalRenderer
- {
- protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
- {
- if (e.ToolStrip is ToolStripDropDown)
- {
- base.OnRenderToolStripBackground(e);
- }
- else
- {
- using (var backBrush = new SolidBrush(e.BackColor))
- {
- e.Graphics.FillRectangle(backBrush, e.AffectedBounds);
- }
- }
- }
-
- protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
- {
- // Do not render a border.
- }
- }
-
- private Label _redLabel;
- private Label _blueLabel;
- private Label _greenLabel;
- private Label _hueLabel;
-
- private NumericUpDown _redUpDown;
- private NumericUpDown _greenUpDown;
- private NumericUpDown _blueUpDown;
- private NumericUpDown _hueUpDown;
- private NumericUpDown _valueUpDown;
- private NumericUpDown _saturationUpDown;
-
- private Container _components;
- private Label _saturationLabel;
- private Label _valueLabel;
- private ComboBox _whichUserColorBox;
- private ColorGradientControl _valueGradientControl;
- private NumericUpDown _alphaUpDown;
- private ColorGradientControl _alphaGradientControl;
- private ColorWheel _colorWheel;
-
- private int _ignoreChangedEvents;
- private ColorBgra _lastPrimaryColor;
- private Button _moreLessButton;
- private ColorBgra _lastSecondaryColor;
-
- private int _suspendSetWhichUserColor;
- private readonly string _lessText;
- private readonly string _moreText;
- private readonly Size _moreSize;
- private readonly Size _lessSize;
- private Control _lessModeButtonSentinel;
- private Control _moreModeButtonSentinel;
- private Control _lessModeHeaderSentinel;
- private Control _moreModeHeaderSentinel;
- private bool _inMoreState = true;
- private Label _hexLabel;
- private TextBox _hexBox;
- private uint _ignore;
- private HeaderLabel _rgbHeader;
- private HeaderLabel _hsvHeader;
- private HeaderLabel _swatchHeader;
- private SwatchControl _swatchControl;
- private ColorDisplayWidget _colorDisplayWidget;
- private ToolStripEx _toolStrip;
- private ToolStripButton _colorAddButton;
- private HeaderLabel _alphaHeader;
-
- private readonly Image _colorAddOverlay;
- private ToolStripSplitButton _colorPalettesButton;
- private Bitmap _colorAddIcon;
- private ColorGradientControl _hueGradientControl;
- private ColorGradientControl _saturationGradientControl;
- private ColorGradientControl _redGradientControl;
- private ColorGradientControl _greenGradientControl;
- private ColorGradientControl _blueGradientControl;
-
- private PaletteCollection _paletteCollection;
-
- public PaletteCollection PaletteCollection
- {
- get
- {
- return _paletteCollection;
- }
-
- set
- {
- _paletteCollection = value;
- }
- }
-
- private bool IgnoreChangedEvents
- {
- get
- {
- return _ignoreChangedEvents != 0;
- }
- }
-
- private class WhichUserColorWrapper
- {
- private readonly WhichUserColor _whichUserColor;
-
- public WhichUserColor WhichUserColor
- {
- get
- {
- return _whichUserColor;
- }
- }
-
- public override int GetHashCode()
- {
- return _whichUserColor.GetHashCode();
- }
-
- public override bool Equals(object obj)
- {
- var rhs = obj as WhichUserColorWrapper;
-
- if (rhs == null)
- {
- return false;
- }
-
- return rhs._whichUserColor == _whichUserColor;
- }
-
- public override string ToString()
- {
- return PdnResources.GetString("WhichUserColor." + _whichUserColor);
- }
-
- public WhichUserColorWrapper(WhichUserColor whichUserColor)
- {
- _whichUserColor = whichUserColor;
- }
- }
-
- public void SuspendSetWhichUserColor()
- {
- ++_suspendSetWhichUserColor;
- }
-
- public void ResumeSetWhichUserColor()
- {
- --_suspendSetWhichUserColor;
- }
-
- public WhichUserColor WhichUserColor
- {
- get
- {
- return ((WhichUserColorWrapper)_whichUserColorBox.SelectedItem).WhichUserColor;
- }
-
- set
- {
- if (_suspendSetWhichUserColor <= 0)
- {
- _whichUserColorBox.SelectedItem = new WhichUserColorWrapper(value);
- }
- }
- }
-
- public void ToggleWhichUserColor()
- {
- switch (WhichUserColor)
- {
- case WhichUserColor.Primary:
- WhichUserColor = WhichUserColor.Secondary;
- break;
-
- case WhichUserColor.Secondary:
- WhichUserColor = WhichUserColor.Primary;
- break;
-
- default:
- throw new InvalidEnumArgumentException();
- }
- }
-
- public void SetColorControlsRedraw(bool enabled)
- {
- var controls =
- new Control[]
- {
- _colorWheel,
- _whichUserColorBox,
- _hueGradientControl,
- _saturationGradientControl,
- _valueGradientControl,
- _redGradientControl,
- _greenGradientControl,
- _blueGradientControl,
- _alphaGradientControl,
- _hueUpDown,
- _saturationUpDown,
- _valueUpDown,
- _redUpDown,
- _greenUpDown,
- _blueUpDown,
- _alphaUpDown,
- _toolStrip
- };
-
- foreach (Control control in controls)
- {
- if (enabled)
- {
- UI.ResumeControlPainting(control);
- control.Invalidate(true);
- }
- else
- {
- UI.SuspendControlPainting(control);
- }
- }
- }
-
- public event ColorEventHandler UserPrimaryColorChanged;
- protected virtual void OnUserPrimaryColorChanged(ColorBgra newColor)
- {
- if (UserPrimaryColorChanged != null && _ignore == 0)
- {
- _userPrimaryColor = newColor;
- UserPrimaryColorChanged(this, new ColorEventArgs(newColor));
- _lastPrimaryColor = newColor;
- _colorDisplayWidget.UserPrimaryColor = newColor;
- }
-
- RenderColorAddIcon(newColor);
- }
-
- private ColorBgra _userPrimaryColor;
- public ColorBgra UserPrimaryColor
- {
- get
- {
- return _userPrimaryColor;
- }
-
- set
- {
- if (IgnoreChangedEvents)
- {
- return;
- }
-
- if (_userPrimaryColor == value) return;
- _userPrimaryColor = value;
- OnUserPrimaryColorChanged(value);
-
- if (WhichUserColor != WhichUserColor.Primary)
- {
- WhichUserColor = WhichUserColor.Primary;
- }
-
- _ignore++;
-
- // only do the update on the last one, so partial RGB info isn't parsed.
- Utility.SetNumericUpDownValue(_alphaUpDown, value.A);
- Utility.SetNumericUpDownValue(_redUpDown, value.R);
- Utility.SetNumericUpDownValue(_greenUpDown, value.G);
- SetColorGradientValuesRgb(value.R, value.G, value.B);
- SetColorGradientMinMaxColorsRgb(value.R, value.G, value.B);
- SetColorGradientMinMaxColorsAlpha(value.A);
-
- _ignore--;
- Utility.SetNumericUpDownValue(_blueUpDown, value.B);
- Update();
-
- string hexText = GetHexNumericUpDownValue(value.R, value.G, value.B);
- _hexBox.Text = hexText;
-
- SyncHsvFromRgb(value);
- _colorDisplayWidget.UserPrimaryColor = _userPrimaryColor;
- }
- }
-
- private static string GetHexNumericUpDownValue(int red, int green, int blue)
- {
- int newHexNumber = (red << 16) | (green << 8) | blue;
- string newHexText = Convert.ToString(newHexNumber, 16);
-
- while (newHexText.Length < 6)
- {
- newHexText = "0" + newHexText;
- }
-
- return newHexText.ToUpper();
- }
-
- public event ColorEventHandler UserSecondaryColorChanged;
- protected virtual void OnUserSecondaryColorChanged(ColorBgra newColor)
- {
- if (UserSecondaryColorChanged != null && _ignore == 0)
- {
- _userSecondaryColor = newColor;
- UserSecondaryColorChanged(this, new ColorEventArgs(newColor));
- _lastSecondaryColor = newColor;
- _colorDisplayWidget.UserSecondaryColor = newColor;
- }
-
- RenderColorAddIcon(newColor);
- }
-
- private ColorBgra _userSecondaryColor;
- public ColorBgra UserSecondaryColor
- {
- get
- {
- return _userSecondaryColor;
- }
-
- set
- {
- if (IgnoreChangedEvents)
- {
- return;
- }
-
- if (_userSecondaryColor == value) return;
- _userSecondaryColor = value;
- OnUserSecondaryColorChanged(value);
-
- if (WhichUserColor != WhichUserColor.Secondary)
- {
- WhichUserColor = WhichUserColor.Secondary;
- }
-
- _ignore++;
-
- //only do the update on the last one, so partial RGB info isn't parsed.
- Utility.SetNumericUpDownValue(_alphaUpDown, value.A);
- Utility.SetNumericUpDownValue(_redUpDown, value.R);
- Utility.SetNumericUpDownValue(_greenUpDown, value.G);
-
- SetColorGradientValuesRgb(value.R, value.G, value.B);
- SetColorGradientMinMaxColorsRgb(value.R, value.G, value.B);
- SetColorGradientMinMaxColorsAlpha(value.A);
-
- _ignore--;
- Utility.SetNumericUpDownValue(_blueUpDown, value.B);
- Update();
-
- string hexText = GetHexNumericUpDownValue(value.R, value.G, value.B);
- _hexBox.Text = hexText;
-
- SyncHsvFromRgb(value);
- _colorDisplayWidget.UserSecondaryColor = _userSecondaryColor;
- }
- }
-
- /// <summary>
- /// Convenience function for ColorsForm internals. Checks the value of the
- /// WhichUserColor property and raises either the UserPrimaryColorChanged or
- /// the UserSecondaryColorChanged events.
- /// </summary>
- /// <param name="newColor">The new color to notify clients about.</param>
- private void OnUserColorChanged(ColorBgra newColor)
- {
- switch (WhichUserColor)
- {
- case WhichUserColor.Primary:
- OnUserPrimaryColorChanged(newColor);
- break;
-
- case WhichUserColor.Secondary:
- OnUserSecondaryColorChanged(newColor);
- break;
-
- default:
- throw new InvalidEnumArgumentException("WhichUserColor property");
- }
- }
-
- /// <summary>
- /// Whenever a color is changed via RGB methods, call this and the HSV
- /// counterparts will be sync'd up.
- /// </summary>
- /// <param name="newColor">The RGB color that should be converted to HSV.</param>
- private void SyncHsvFromRgb(ColorBgra newColor)
- {
- if (_ignore != 0) return;
- _ignore++;
- HsvColor hsvColor = HsvColor.FromColor(newColor.ToColor());
-
- Utility.SetNumericUpDownValue(_hueUpDown, hsvColor.Hue);
- Utility.SetNumericUpDownValue(_saturationUpDown, hsvColor.Saturation);
- Utility.SetNumericUpDownValue(_valueUpDown, hsvColor.Value);
-
- SetColorGradientValuesHsv(hsvColor.Hue, hsvColor.Saturation, hsvColor.Value);
- SetColorGradientMinMaxColorsHsv(hsvColor.Hue, hsvColor.Saturation, hsvColor.Value);
-
- _colorWheel.HsvColor = hsvColor;
- _ignore--;
- }
-
- private void SetColorGradientValuesRgb(int r, int g, int b)
- {
- PushIgnoreChangedEvents();
-
- if (_redGradientControl.Value != r)
- {
- _redGradientControl.Value = r;
- }
-
- if (_greenGradientControl.Value != g)
- {
- _greenGradientControl.Value = g;
- }
-
- if (_blueGradientControl.Value != b)
- {
- _blueGradientControl.Value = b;
- }
-
- PopIgnoreChangedEvents();
- }
-
- private void SetColorGradientValuesHsv(int h, int s, int v)
- {
- PushIgnoreChangedEvents();
-
- if (((_hueGradientControl.Value * 360) / 255) != h)
- {
- _hueGradientControl.Value = (255 * h) / 360;
- }
-
- if (((_saturationGradientControl.Value * 100) / 255) != s)
- {
- _saturationGradientControl.Value = (255 * s) / 100;
- }
-
- if (((_valueGradientControl.Value * 100) / 255) != v)
- {
- _valueGradientControl.Value = (255 * v) / 100;
- }
-
- PopIgnoreChangedEvents();
- }
-
- /// <summary>
- /// Whenever a color is changed via HSV methods, call this and the RGB
- /// counterparts will be sync'd up.
- /// </summary>
- /// <param name="newColor">The HSV color that should be converted to RGB.</param>
- private void SyncRgbFromHsv(HsvColor newColor)
- {
- if (_ignore != 0) return;
- _ignore++;
- RgbColor rgbColor = newColor.ToRgb();
-
- Utility.SetNumericUpDownValue(_redUpDown, rgbColor.Red);
- Utility.SetNumericUpDownValue(_greenUpDown, rgbColor.Green);
- Utility.SetNumericUpDownValue(_blueUpDown, rgbColor.Blue);
-
- string hexText = GetHexNumericUpDownValue(rgbColor.Red, rgbColor.Green, rgbColor.Blue);
- _hexBox.Text = hexText;
-
- SetColorGradientValuesRgb(rgbColor.Red, rgbColor.Green, rgbColor.Blue);
- SetColorGradientMinMaxColorsRgb(rgbColor.Red, rgbColor.Green, rgbColor.Blue);
- SetColorGradientMinMaxColorsAlpha((int)_alphaUpDown.Value);
-
- _ignore--;
- }
-
- private void RenderColorAddIcon(ColorBgra newColor)
- {
- if (_colorAddIcon == null)
- {
- _colorAddIcon = new Bitmap(16, 16, PixelFormat.Format32bppArgb);
- }
-
- using (Graphics g = Graphics.FromImage(_colorAddIcon))
- {
- var rect = new Rectangle(0, 0, _colorAddIcon.Width - 2, _colorAddIcon.Height - 2);
- Utility.DrawColorRectangle(g, rect, newColor.ToColor(), true);
- g.DrawImage(_colorAddOverlay, 0, 0);
- }
-
- _colorAddButton.Image = _colorAddIcon;
- _colorAddButton.Invalidate();
- }
-
- public ColorsForm()
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
-
- _whichUserColorBox.Items.Add(new WhichUserColorWrapper(WhichUserColor.Primary));
- _whichUserColorBox.Items.Add(new WhichUserColorWrapper(WhichUserColor.Secondary));
- _whichUserColorBox.SelectedIndex = 0;
-
- _moreSize = ClientSize;
- _lessSize = new Size(_swatchHeader.Width + UI.ScaleWidth(16), _moreSize.Height);
-
- Text = PdnResources.GetString("ColorsForm.Text");
- _redLabel.Text = PdnResources.GetString("ColorsForm.RedLabel.Text");
- _blueLabel.Text = PdnResources.GetString("ColorsForm.BlueLabel.Text");
- _greenLabel.Text = PdnResources.GetString("ColorsForm.GreenLabel.Text");
- _saturationLabel.Text = PdnResources.GetString("ColorsForm.SaturationLabel.Text");
- _valueLabel.Text = PdnResources.GetString("ColorsForm.ValueLabel.Text");
- _hueLabel.Text = PdnResources.GetString("ColorsForm.HueLabel.Text");
- _rgbHeader.Text = PdnResources.GetString("ColorsForm.RgbHeader.Text");
- _hexLabel.Text = PdnResources.GetString("ColorsForm.HexLabel.Text");
- _hsvHeader.Text = PdnResources.GetString("ColorsForm.HsvHeader.Text");
- _alphaHeader.Text = PdnResources.GetString("ColorsForm.AlphaHeader.Text");
-
- _lessText = "<< " + PdnResources.GetString("ColorsForm.MoreLessButton.Text.Less");
- _moreText = PdnResources.GetString("ColorsForm.MoreLessButton.Text.More") + " >>";
- _moreLessButton.Text = _lessText;
-
- _toolStrip.Renderer = new OurToolStripRenderer();
-
- _colorAddOverlay = PdnResources.GetImageResource("Icons.ColorAddOverlay.png").Reference;
- _colorPalettesButton.Image = PdnResources.GetImageResource("Icons.ColorPalettes.png").Reference;
-
- RenderColorAddIcon(UserPrimaryColor);
-
- _colorAddButton.ToolTipText = PdnResources.GetString("ColorsForm.ColorAddButton.ToolTipText");
- _colorPalettesButton.ToolTipText = PdnResources.GetString("ColorsForm.ColorPalettesButton.ToolTipText");
-
- // Load the current palette
- string currentPaletteString;
-
- try
- {
- currentPaletteString = Settings.CurrentUser.GetString(SettingNames.CurrentPalette, null);
- }
-
- catch (Exception)
- {
- currentPaletteString = null;
- }
-
- if (currentPaletteString == null)
- {
- string defaultPaletteString = PaletteCollection.GetPaletteSaveString(PaletteCollection.DefaultPalette);
- currentPaletteString = defaultPaletteString;
- }
-
- ColorBgra[] currentPalette = PaletteCollection.ParsePaletteString(currentPaletteString);
-
- _swatchControl.Colors = currentPalette;
- }
-
- public override sealed string Text
- {
- get { return base.Text; }
- set { base.Text = value; }
- }
-
- protected override void OnLoad(EventArgs e)
- {
- _inMoreState = true;
- _moreLessButton.PerformClick();
- base.OnLoad(e);
- }
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- if (_components != null)
- {
- _components.Dispose();
- _components = null;
- }
- }
-
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this._valueGradientControl = new PaintDotNet.ColorGradientControl();
- this._colorWheel = new PaintDotNet.ColorWheel();
- this._redUpDown = new System.Windows.Forms.NumericUpDown();
- this._greenUpDown = new System.Windows.Forms.NumericUpDown();
- this._blueUpDown = new System.Windows.Forms.NumericUpDown();
- this._redLabel = new System.Windows.Forms.Label();
- this._blueLabel = new System.Windows.Forms.Label();
- this._greenLabel = new System.Windows.Forms.Label();
- this._saturationLabel = new System.Windows.Forms.Label();
- this._valueLabel = new System.Windows.Forms.Label();
- this._hueLabel = new System.Windows.Forms.Label();
- this._valueUpDown = new System.Windows.Forms.NumericUpDown();
- this._saturationUpDown = new System.Windows.Forms.NumericUpDown();
- this._hueUpDown = new System.Windows.Forms.NumericUpDown();
- this._hexBox = new System.Windows.Forms.TextBox();
- this._hexLabel = new System.Windows.Forms.Label();
- this._whichUserColorBox = new System.Windows.Forms.ComboBox();
- this._alphaUpDown = new System.Windows.Forms.NumericUpDown();
- this._moreLessButton = new System.Windows.Forms.Button();
- this._lessModeButtonSentinel = new System.Windows.Forms.Control();
- this._moreModeButtonSentinel = new System.Windows.Forms.Control();
- this._lessModeHeaderSentinel = new System.Windows.Forms.Control();
- this._moreModeHeaderSentinel = new System.Windows.Forms.Control();
- this._rgbHeader = new PaintDotNet.HeaderLabel();
- this._hsvHeader = new PaintDotNet.HeaderLabel();
- this._alphaHeader = new PaintDotNet.HeaderLabel();
- this._swatchHeader = new PaintDotNet.HeaderLabel();
- this._swatchControl = new PaintDotNet.SwatchControl();
- this._colorDisplayWidget = new PaintDotNet.ColorDisplayWidget();
- this._toolStrip = new PaintDotNet.SystemLayer.ToolStripEx();
- this._colorAddButton = new System.Windows.Forms.ToolStripButton();
- this._colorPalettesButton = new System.Windows.Forms.ToolStripSplitButton();
- this._hueGradientControl = new PaintDotNet.ColorGradientControl();
- this._saturationGradientControl = new PaintDotNet.ColorGradientControl();
- this._alphaGradientControl = new PaintDotNet.ColorGradientControl();
- this._redGradientControl = new PaintDotNet.ColorGradientControl();
- this._greenGradientControl = new PaintDotNet.ColorGradientControl();
- this._blueGradientControl = new PaintDotNet.ColorGradientControl();
- ((System.ComponentModel.ISupportInitialize)(this._redUpDown)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this._greenUpDown)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this._blueUpDown)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this._valueUpDown)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this._saturationUpDown)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this._hueUpDown)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this._alphaUpDown)).BeginInit();
- this._toolStrip.SuspendLayout();
- this.SuspendLayout();
- //
- // valueGradientControl
- //
- this._valueGradientControl.Count = 1;
- this._valueGradientControl.CustomGradient = null;
- this._valueGradientControl.DrawFarNub = true;
- this._valueGradientControl.DrawNearNub = false;
- this._valueGradientControl.Location = new System.Drawing.Point(243, 185);
- this._valueGradientControl.MaxColor = System.Drawing.Color.White;
- this._valueGradientControl.MinColor = System.Drawing.Color.Black;
- this._valueGradientControl.Name = "_valueGradientControl";
- this._valueGradientControl.Orientation = System.Windows.Forms.Orientation.Horizontal;
- this._valueGradientControl.Size = new System.Drawing.Size(73, 19);
- this._valueGradientControl.TabIndex = 2;
- this._valueGradientControl.TabStop = false;
- this._valueGradientControl.Value = 0;
- this._valueGradientControl.ValueChanged += new PaintDotNet.IndexEventHandler(this.HsvGradientControlValueChanged);
- //
- // colorWheel
- //
- this._colorWheel.Location = new System.Drawing.Point(65, 35);
- this._colorWheel.Name = "_colorWheel";
- this._colorWheel.Size = new System.Drawing.Size(129, 130);
- this._colorWheel.TabIndex = 3;
- this._colorWheel.TabStop = false;
- this._colorWheel.ColorChanged += new System.EventHandler(this.ColorWheelColorChanged);
- //
- // redUpDown
- //
- this._redUpDown.Location = new System.Drawing.Point(320, 24);
- this._redUpDown.Maximum = new decimal(new int[] {
- 255,
- 0,
- 0,
- 0});
- this._redUpDown.Name = "_redUpDown";
- this._redUpDown.Size = new System.Drawing.Size(56, 20);
- this._redUpDown.TabIndex = 2;
- this._redUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
- this._redUpDown.Enter += new System.EventHandler(this.UpDownEnter);
- this._redUpDown.ValueChanged += new System.EventHandler(this.UpDownValueChanged);
- this._redUpDown.Leave += new System.EventHandler(this.UpDownLeave);
- this._redUpDown.KeyUp += new System.Windows.Forms.KeyEventHandler(this.UpDownKeyUp);
- //
- // greenUpDown
- //
- this._greenUpDown.Location = new System.Drawing.Point(320, 48);
- this._greenUpDown.Maximum = new decimal(new int[] {
- 255,
- 0,
- 0,
- 0});
- this._greenUpDown.Name = "_greenUpDown";
- this._greenUpDown.Size = new System.Drawing.Size(56, 20);
- this._greenUpDown.TabIndex = 3;
- this._greenUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
- this._greenUpDown.Enter += new System.EventHandler(this.UpDownEnter);
- this._greenUpDown.ValueChanged += new System.EventHandler(this.UpDownValueChanged);
- this._greenUpDown.Leave += new System.EventHandler(this.UpDownLeave);
- this._greenUpDown.KeyUp += new System.Windows.Forms.KeyEventHandler(this.UpDownKeyUp);
- //
- // blueUpDown
- //
- this._blueUpDown.Location = new System.Drawing.Point(320, 72);
- this._blueUpDown.Maximum = new decimal(new int[] {
- 255,
- 0,
- 0,
- 0});
- this._blueUpDown.Name = "_blueUpDown";
- this._blueUpDown.Size = new System.Drawing.Size(56, 20);
- this._blueUpDown.TabIndex = 4;
- this._blueUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
- this._blueUpDown.Enter += new System.EventHandler(this.UpDownEnter);
- this._blueUpDown.ValueChanged += new System.EventHandler(this.UpDownValueChanged);
- this._blueUpDown.Leave += new System.EventHandler(this.UpDownLeave);
- this._blueUpDown.KeyUp += new System.Windows.Forms.KeyEventHandler(this.UpDownKeyUp);
- //
- // redLabel
- //
- this._redLabel.AutoSize = true;
- this._redLabel.Location = new System.Drawing.Point(222, 28);
- this._redLabel.Name = "_redLabel";
- this._redLabel.Size = new System.Drawing.Size(15, 13);
- this._redLabel.TabIndex = 7;
- this._redLabel.Text = "R";
- this._redLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // blueLabel
- //
- this._blueLabel.AutoSize = true;
- this._blueLabel.Location = new System.Drawing.Point(222, 76);
- this._blueLabel.Name = "_blueLabel";
- this._blueLabel.Size = new System.Drawing.Size(14, 13);
- this._blueLabel.TabIndex = 8;
- this._blueLabel.Text = "B";
- this._blueLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // greenLabel
- //
- this._greenLabel.AutoSize = true;
- this._greenLabel.Location = new System.Drawing.Point(222, 52);
- this._greenLabel.Name = "_greenLabel";
- this._greenLabel.Size = new System.Drawing.Size(15, 13);
- this._greenLabel.TabIndex = 9;
- this._greenLabel.Text = "G";
- this._greenLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // saturationLabel
- //
- this._saturationLabel.AutoSize = true;
- this._saturationLabel.Location = new System.Drawing.Point(222, 164);
- this._saturationLabel.Name = "_saturationLabel";
- this._saturationLabel.Size = new System.Drawing.Size(17, 13);
- this._saturationLabel.TabIndex = 16;
- this._saturationLabel.Text = "S:";
- this._saturationLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // valueLabel
- //
- this._valueLabel.AutoSize = true;
- this._valueLabel.Location = new System.Drawing.Point(222, 188);
- this._valueLabel.Name = "_valueLabel";
- this._valueLabel.Size = new System.Drawing.Size(17, 13);
- this._valueLabel.TabIndex = 15;
- this._valueLabel.Text = "V:";
- this._valueLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // hueLabel
- //
- this._hueLabel.AutoSize = true;
- this._hueLabel.Location = new System.Drawing.Point(222, 140);
- this._hueLabel.Name = "_hueLabel";
- this._hueLabel.Size = new System.Drawing.Size(18, 13);
- this._hueLabel.TabIndex = 14;
- this._hueLabel.Text = "H:";
- this._hueLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // valueUpDown
- //
- this._valueUpDown.Location = new System.Drawing.Point(320, 184);
- this._valueUpDown.Name = "_valueUpDown";
- this._valueUpDown.Size = new System.Drawing.Size(56, 20);
- this._valueUpDown.TabIndex = 8;
- this._valueUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
- this._valueUpDown.Enter += new System.EventHandler(this.UpDownEnter);
- this._valueUpDown.ValueChanged += new System.EventHandler(this.UpDownValueChanged);
- this._valueUpDown.Leave += new System.EventHandler(this.UpDownLeave);
- this._valueUpDown.KeyUp += new System.Windows.Forms.KeyEventHandler(this.UpDownKeyUp);
- //
- // saturationUpDown
- //
- this._saturationUpDown.Location = new System.Drawing.Point(320, 160);
- this._saturationUpDown.Name = "_saturationUpDown";
- this._saturationUpDown.Size = new System.Drawing.Size(56, 20);
- this._saturationUpDown.TabIndex = 7;
- this._saturationUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
- this._saturationUpDown.Enter += new System.EventHandler(this.UpDownEnter);
- this._saturationUpDown.ValueChanged += new System.EventHandler(this.UpDownValueChanged);
- this._saturationUpDown.Leave += new System.EventHandler(this.UpDownLeave);
- this._saturationUpDown.KeyUp += new System.Windows.Forms.KeyEventHandler(this.UpDownKeyUp);
- //
- // hueUpDown
- //
- this._hueUpDown.Location = new System.Drawing.Point(320, 136);
- this._hueUpDown.Maximum = new decimal(new int[] {
- 360,
- 0,
- 0,
- 0});
- this._hueUpDown.Name = "_hueUpDown";
- this._hueUpDown.Size = new System.Drawing.Size(56, 20);
- this._hueUpDown.TabIndex = 6;
- this._hueUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
- this._hueUpDown.Enter += new System.EventHandler(this.UpDownEnter);
- this._hueUpDown.ValueChanged += new System.EventHandler(this.UpDownValueChanged);
- this._hueUpDown.Leave += new System.EventHandler(this.UpDownLeave);
- this._hueUpDown.KeyUp += new System.Windows.Forms.KeyEventHandler(this.UpDownKeyUp);
- //
- // hexBox
- //
- this._hexBox.Location = new System.Drawing.Point(320, 96);
- this._hexBox.Name = "_hexBox";
- this._hexBox.Size = new System.Drawing.Size(56, 20);
- this._hexBox.TabIndex = 5;
- this._hexBox.Text = "000000";
- this._hexBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
- this._hexBox.Enter += new System.EventHandler(this.HexUpDownEnter);
- this._hexBox.Leave += new System.EventHandler(this.HexUpDownLeave);
- this._hexBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.HexUpDownKeyUp);
- this._hexBox.TextChanged += new System.EventHandler(this.UpDownValueChanged);
- //
- // hexLabel
- //
- this._hexLabel.AutoSize = true;
- this._hexLabel.Location = new System.Drawing.Point(222, 99);
- this._hexLabel.Name = "_hexLabel";
- this._hexLabel.Size = new System.Drawing.Size(26, 13);
- this._hexLabel.TabIndex = 13;
- this._hexLabel.Text = "Hex";
- this._hexLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // whichUserColorBox
- //
- this._whichUserColorBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this._whichUserColorBox.Location = new System.Drawing.Point(8, 8);
- this._whichUserColorBox.Name = "_whichUserColorBox";
- this._whichUserColorBox.Size = new System.Drawing.Size(112, 21);
- this._whichUserColorBox.TabIndex = 0;
- this._whichUserColorBox.SelectedIndexChanged += new System.EventHandler(this.WhichUserColorBoxSelectedIndexChanged);
- //
- // alphaUpDown
- //
- this._alphaUpDown.Location = new System.Drawing.Point(320, 228);
- this._alphaUpDown.Maximum = new decimal(new int[] {
- 255,
- 0,
- 0,
- 0});
- this._alphaUpDown.Name = "_alphaUpDown";
- this._alphaUpDown.Size = new System.Drawing.Size(56, 20);
- this._alphaUpDown.TabIndex = 10;
- this._alphaUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
- this._alphaUpDown.Enter += new System.EventHandler(this.UpDownEnter);
- this._alphaUpDown.ValueChanged += new System.EventHandler(this.UpDownValueChanged);
- this._alphaUpDown.Leave += new System.EventHandler(this.UpDownLeave);
- this._alphaUpDown.KeyUp += new System.Windows.Forms.KeyEventHandler(this.UpDownKeyUp);
- //
- // moreLessButton
- //
- this._moreLessButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this._moreLessButton.Location = new System.Drawing.Point(126, 7);
- this._moreLessButton.Name = "_moreLessButton";
- this._moreLessButton.Size = new System.Drawing.Size(75, 23);
- this._moreLessButton.TabIndex = 1;
- this._moreLessButton.Click += new System.EventHandler(this.MoreLessButtonClick);
- //
- // lessModeButtonSentinel
- //
- this._lessModeButtonSentinel.Location = new System.Drawing.Point(128, 7);
- this._lessModeButtonSentinel.Name = "_lessModeButtonSentinel";
- this._lessModeButtonSentinel.Size = new System.Drawing.Size(0, 0);
- this._lessModeButtonSentinel.TabIndex = 22;
- this._lessModeButtonSentinel.Text = "we put the lessMore control here when in \"Less\" mode";
- this._lessModeButtonSentinel.Visible = false;
- //
- // moreModeButtonSentinel
- //
- this._moreModeButtonSentinel.Location = new System.Drawing.Point(165, 7);
- this._moreModeButtonSentinel.Name = "_moreModeButtonSentinel";
- this._moreModeButtonSentinel.Size = new System.Drawing.Size(0, 0);
- this._moreModeButtonSentinel.TabIndex = 23;
- this._moreModeButtonSentinel.Visible = false;
- //
- // lessModeHeaderSentinel
- //
- this._lessModeHeaderSentinel.Location = new System.Drawing.Point(8, 40);
- this._lessModeHeaderSentinel.Name = "_lessModeHeaderSentinel";
- this._lessModeHeaderSentinel.Size = new System.Drawing.Size(195, 185);
- this._lessModeHeaderSentinel.TabIndex = 24;
- this._lessModeHeaderSentinel.Visible = false;
- //
- // moreModeHeaderSentinel
- //
- this._moreModeHeaderSentinel.Location = new System.Drawing.Point(8, 40);
- this._moreModeHeaderSentinel.Name = "_moreModeHeaderSentinel";
- this._moreModeHeaderSentinel.Size = new System.Drawing.Size(232, 216);
- this._moreModeHeaderSentinel.TabIndex = 25;
- this._moreModeHeaderSentinel.TabStop = false;
- this._moreModeHeaderSentinel.Visible = false;
- //
- // rgbHeader
- //
- this._rgbHeader.Location = new System.Drawing.Point(222, 8);
- this._rgbHeader.Name = "_rgbHeader";
- this._rgbHeader.RightMargin = 0;
- this._rgbHeader.Size = new System.Drawing.Size(154, 14);
- this._rgbHeader.TabIndex = 27;
- this._rgbHeader.TabStop = false;
- //
- // hsvHeader
- //
- this._hsvHeader.Location = new System.Drawing.Point(222, 120);
- this._hsvHeader.Name = "_hsvHeader";
- this._hsvHeader.RightMargin = 0;
- this._hsvHeader.Size = new System.Drawing.Size(154, 14);
- this._hsvHeader.TabIndex = 28;
- this._hsvHeader.TabStop = false;
- //
- // alphaHeader
- //
- this._alphaHeader.Location = new System.Drawing.Point(222, 212);
- this._alphaHeader.Name = "_alphaHeader";
- this._alphaHeader.RightMargin = 0;
- this._alphaHeader.Size = new System.Drawing.Size(154, 14);
- this._alphaHeader.TabIndex = 29;
- this._alphaHeader.TabStop = false;
- //
- // swatchHeader
- //
- this._swatchHeader.Location = new System.Drawing.Point(8, 177);
- this._swatchHeader.Name = "_swatchHeader";
- this._swatchHeader.RightMargin = 0;
- this._swatchHeader.Size = new System.Drawing.Size(193, 14);
- this._swatchHeader.TabIndex = 30;
- this._swatchHeader.TabStop = false;
- //
- // swatchControl
- //
- this._swatchControl.BlinkHighlight = false;
- this._swatchControl.Colors = new PaintDotNet.ColorBgra[0];
- this._swatchControl.Location = new System.Drawing.Point(8, 189);
- this._swatchControl.Name = "_swatchControl";
- this._swatchControl.Size = new System.Drawing.Size(192, 74);
- this._swatchControl.TabIndex = 31;
- this._swatchControl.Text = "swatchControl1";
- this._swatchControl.ColorsChanged += this.SwatchControlColorsChanged;
- this._swatchControl.ColorClicked += this.SwatchControlColorClicked;
- //
- // colorDisplayWidget
- //
- this._colorDisplayWidget.Location = new System.Drawing.Point(4, 32);
- this._colorDisplayWidget.Name = "_colorDisplayWidget";
- this._colorDisplayWidget.Size = new System.Drawing.Size(52, 52);
- this._colorDisplayWidget.TabIndex = 32;
- this._colorDisplayWidget.BlackAndWhiteButtonClicked += ColorDisplayWidgetBlackAndWhiteButtonClicked;
- this._colorDisplayWidget.SwapColorsClicked += ColorDisplayWidgetSwapColorsClicked;
- this._colorDisplayWidget.UserPrimaryColorClick += ColorDisplayPrimaryColorClicked;
- this._colorDisplayWidget.UserSecondaryColorClick += ColorDisplaySecondaryColorClicked;
- //
- // toolStrip
- //
- this._toolStrip.ClickThrough = true;
- this._toolStrip.Dock = System.Windows.Forms.DockStyle.None;
- this._toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
- this._toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this._colorAddButton,
- this._colorPalettesButton});
- this._toolStrip.Location = new System.Drawing.Point(5, 157);
- this._toolStrip.ManagedFocus = true;
- this._toolStrip.Name = "_toolStrip";
- this._toolStrip.Size = new System.Drawing.Size(65, 25);
- this._toolStrip.TabIndex = 33;
- this._toolStrip.Text = "toolStrip";
- //
- // colorAddButton
- //
- this._colorAddButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
- this._colorAddButton.ImageTransparentColor = System.Drawing.Color.Magenta;
- this._colorAddButton.Name = "colorAddButton";
- this._colorAddButton.Size = new System.Drawing.Size(23, 22);
- this._colorAddButton.Text = "colorAddButton";
- this._colorAddButton.Click += new System.EventHandler(this.ColorAddButtonClick);
- //
- // colorPalettesButton
- //
- this._colorPalettesButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
- this._colorPalettesButton.Name = "colorPalettesButton";
- this._colorPalettesButton.Size = new System.Drawing.Size(16, 22);
- this._colorPalettesButton.Click += new System.EventHandler(this.ColorPalettesButtonClick);
- this._colorPalettesButton.DropDownOpening += new System.EventHandler(this.ColorPalettesButtonDropDownOpening);
- //
- // hueGradientControl
- //
- this._hueGradientControl.Count = 1;
- this._hueGradientControl.CustomGradient = null;
- this._hueGradientControl.DrawFarNub = true;
- this._hueGradientControl.DrawNearNub = false;
- this._hueGradientControl.Location = new System.Drawing.Point(243, 137);
- this._hueGradientControl.MaxColor = System.Drawing.Color.White;
- this._hueGradientControl.MinColor = System.Drawing.Color.Black;
- this._hueGradientControl.Name = "_hueGradientControl";
- this._hueGradientControl.Orientation = System.Windows.Forms.Orientation.Horizontal;
- this._hueGradientControl.Size = new System.Drawing.Size(73, 19);
- this._hueGradientControl.TabIndex = 34;
- this._hueGradientControl.TabStop = false;
- this._hueGradientControl.Value = 0;
- this._hueGradientControl.ValueChanged += new PaintDotNet.IndexEventHandler(this.HsvGradientControlValueChanged);
- //
- // saturationGradientControl
- //
- this._saturationGradientControl.Count = 1;
- this._saturationGradientControl.CustomGradient = null;
- this._saturationGradientControl.DrawFarNub = true;
- this._saturationGradientControl.DrawNearNub = false;
- this._saturationGradientControl.Location = new System.Drawing.Point(243, 161);
- this._saturationGradientControl.MaxColor = System.Drawing.Color.White;
- this._saturationGradientControl.MinColor = System.Drawing.Color.Black;
- this._saturationGradientControl.Name = "_saturationGradientControl";
- this._saturationGradientControl.Orientation = System.Windows.Forms.Orientation.Horizontal;
- this._saturationGradientControl.Size = new System.Drawing.Size(73, 19);
- this._saturationGradientControl.TabIndex = 35;
- this._saturationGradientControl.TabStop = false;
- this._saturationGradientControl.Value = 0;
- this._saturationGradientControl.ValueChanged += new PaintDotNet.IndexEventHandler(this.HsvGradientControlValueChanged);
- //
- // alphaGradientControl
- //
- this._alphaGradientControl.Count = 1;
- this._alphaGradientControl.CustomGradient = null;
- this._alphaGradientControl.DrawFarNub = true;
- this._alphaGradientControl.DrawNearNub = false;
- this._alphaGradientControl.Location = new System.Drawing.Point(243, 229);
- this._alphaGradientControl.MaxColor = System.Drawing.Color.White;
- this._alphaGradientControl.MinColor = System.Drawing.Color.Black;
- this._alphaGradientControl.Name = "_alphaGradientControl";
- this._alphaGradientControl.Orientation = System.Windows.Forms.Orientation.Horizontal;
- this._alphaGradientControl.Size = new System.Drawing.Size(73, 19);
- this._alphaGradientControl.TabIndex = 36;
- this._alphaGradientControl.TabStop = false;
- this._alphaGradientControl.Value = 0;
- this._alphaGradientControl.ValueChanged += new PaintDotNet.IndexEventHandler(this.UpDownValueChanged);
- //
- // redGradientControl
- //
- this._redGradientControl.Count = 1;
- this._redGradientControl.CustomGradient = null;
- this._redGradientControl.DrawFarNub = true;
- this._redGradientControl.DrawNearNub = false;
- this._redGradientControl.Location = new System.Drawing.Point(243, 25);
- this._redGradientControl.MaxColor = System.Drawing.Color.White;
- this._redGradientControl.MinColor = System.Drawing.Color.Black;
- this._redGradientControl.Name = "_redGradientControl";
- this._redGradientControl.Orientation = System.Windows.Forms.Orientation.Horizontal;
- this._redGradientControl.Size = new System.Drawing.Size(73, 19);
- this._redGradientControl.TabIndex = 37;
- this._redGradientControl.TabStop = false;
- this._redGradientControl.Value = 0;
- this._redGradientControl.ValueChanged += new PaintDotNet.IndexEventHandler(this.RgbGradientControlValueChanged);
- //
- // greenGradientControl
- //
- this._greenGradientControl.Count = 1;
- this._greenGradientControl.CustomGradient = null;
- this._greenGradientControl.DrawFarNub = true;
- this._greenGradientControl.DrawNearNub = false;
- this._greenGradientControl.Location = new System.Drawing.Point(243, 49);
- this._greenGradientControl.MaxColor = System.Drawing.Color.White;
- this._greenGradientControl.MinColor = System.Drawing.Color.…
Large files files are truncated, but you can click here to view the full file