Skip to content

Commit

Permalink
Use NumericSlider instead of IntegerSlider in ColorPicker control.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Kovalenko committed Oct 19, 2014
1 parent cb0726f commit ca40ee4
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 100 deletions.
174 changes: 83 additions & 91 deletions src/editors/xrSdkControls/Controls/ColorPicker/ColorPicker.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions src/editors/xrSdkControls/Controls/ColorPicker/ColorPicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,30 @@ public bool Hexadecimal
return;
hexadecimal = value;
chkHexadecimal.Checked = value;
islRed.Hexadecimal = value;
islGreen.Hexadecimal = value;
islBlue.Hexadecimal = value;
islAlpha.Hexadecimal = value;
nslRed.Hexadecimal = value;
nslGreen.Hexadecimal = value;
nslBlue.Hexadecimal = value;
nslAlpha.Hexadecimal = value;
}
}

private void ColorPicker_Load(object sender, EventArgs e)
{
islRed.ValueChanged += (obj, args) => UpdateColor();
islGreen.ValueChanged += (obj, args) => UpdateColor();
islBlue.ValueChanged += (obj, args) => UpdateColor();
islAlpha.ValueChanged += (obj, args) => UpdateColor();
nslRed.ValueChanged += (obj, args) => UpdateColor();
nslGreen.ValueChanged += (obj, args) => UpdateColor();
nslBlue.ValueChanged += (obj, args) => UpdateColor();
nslAlpha.ValueChanged += (obj, args) => UpdateColor();
chkHexadecimal.CheckedChanged += (obj, args) => Hexadecimal = chkHexadecimal.Checked;
UpdateColor();
}

private void UpdateColor()
{
var newColor = Color.FromArgb(islAlpha.Value, islRed.Value, islGreen.Value, islBlue.Value);
var newColor = Color.FromArgb(
Convert.ToInt32(nslAlpha.Value),
Convert.ToInt32(nslRed.Value),
Convert.ToInt32(nslGreen.Value),
Convert.ToInt32(nslBlue.Value));
if (pbColor.ColorSample == newColor)
return;
pbColor.ColorSample = newColor;
Expand Down

0 comments on commit ca40ee4

Please sign in to comment.