diff --git a/System/Windows/Forms/ColorPicker.cs b/System/Windows/Forms/ColorPicker.cs index f1c1d92..57e0f4d 100644 --- a/System/Windows/Forms/ColorPicker.cs +++ b/System/Windows/Forms/ColorPicker.cs @@ -456,7 +456,7 @@ private void _UpdateImage() for (int k = 0; k < _image.Height; k++) { - luminosity = (float)k / _image.Height; + luminosity = 1f - (float)k / _image.Height; // HSL to RGB convertion. Color pixelColor = Color.FromHsb(hue, saturation, luminosity); diff --git a/System/Windows/Forms/Form.cs b/System/Windows/Forms/Form.cs index ebf544e..dff6101 100644 --- a/System/Windows/Forms/Form.cs +++ b/System/Windows/Forms/Form.cs @@ -350,13 +350,13 @@ public void SetResize(ControlResizeTypes resize) break; } } - public void Show(bool shouldFocus = true) + public void Show(bool fShouldFocus = true) { Visible = true; int self = Owner.Forms.FindIndex(x => x == this); if (self == -1) Owner.Forms.Add(this); - if (shouldFocus) + if (fShouldFocus) { Focus(); _SelectFirstControl(); diff --git a/System/Windows/Forms/NumericUpDown.cs b/System/Windows/Forms/NumericUpDown.cs index dd53854..6d6d7b3 100644 --- a/System/Windows/Forms/NumericUpDown.cs +++ b/System/Windows/Forms/NumericUpDown.cs @@ -55,15 +55,9 @@ public decimal Value _value = value; valueText = value.ToString(); if (changed) - { ValueChanged(this, null); - if (ValueChangedCallback != null) - ValueChangedCallback.Invoke(ValueChangedCallbackInfo); - } } } - public CallbackDelegate ValueChangedCallback { get; set; } - public object ValueChangedCallbackInfo { get; set; } public NumericUpDown() : this(true) { @@ -114,27 +108,19 @@ public NumericUpDown(bool initButtons) Controls.Add(ButtonDecrease); } - Resize += _UpdateButtonsLocation; - LostFocus += (s, a) => { _ConfirmValue(); }; + Resize += UpdateButtonsLocation; + LostFocus += (s, a) => { ConfirmValue(); }; } - private void _ConfirmValue() + public event EventHandler ValueChanged = delegate { }; + + protected void ConfirmValue() { decimal value = Value; if (decimal.TryParse(valueText, out value)) if (Value != value) Value = value; } - private void _UpdateButtonsLocation(object sender, EventArgs e) - { - if (ButtonIncrease != null) - ButtonIncrease.Location = new Point(Width - 16, Height / 2 - 8); - if (ButtonDecrease != null) - ButtonDecrease.Location = new Point(Width - 16, Height / 2); - } - - public event EventHandler ValueChanged = delegate { }; - public void HideButtons() { ButtonIncrease.Visible = false; @@ -151,7 +137,7 @@ protected override void OnKeyPress(KeyEventArgs e) base.OnKeyPress(e); if (e.KeyCode == UnityEngine.KeyCode.Return) - _ConfirmValue(); + ConfirmValue(); } protected override void OnMouseWheel(MouseEventArgs e) { @@ -187,7 +173,12 @@ public void ShowButtons() ButtonIncrease.Visible = true; ButtonDecrease.Visible = true; } - - public delegate void CallbackDelegate(object data); + protected void UpdateButtonsLocation(object sender, EventArgs e) + { + if (ButtonIncrease != null) + ButtonIncrease.Location = new Point(Width - 16, Height / 2 - 8); + if (ButtonDecrease != null) + ButtonDecrease.Location = new Point(Width - 16, Height / 2); + } } }