private void _SyncState(object sender) { if (Equals(TextBox_ColorHex, sender)) ColorARGBHSV = ColorARGBHSV.FromStringHex(GetTextBoxHex()); if (Equals(TextBox_ColorAlpha, sender)) ColorARGBHSV.A = GetTextBoxAlpha(); if (Equals(TextBox_ColorRed, sender)) ColorARGBHSV.R = GetTextBoxRed(); if (Equals(TextBox_ColorGreen, sender)) ColorARGBHSV.G = GetTextBoxGreen(); if (Equals(TextBox_ColorBlue, sender)) ColorARGBHSV.B = GetTextBoxBlue(); if (Equals(TextBox_ColorHue, sender)) ColorARGBHSV.H = GetTextBoxHue(); if (Equals(TextBox_ColorSaturation, sender)) ColorARGBHSV.S = GetTextBoxSaturation(); if (Equals(TextBox_ColorValue, sender)) ColorARGBHSV.V = GetTextBoxValue(); if (Equals(Grid_HookBar, sender)) ColorARGBHSV.H = _yBar / 255d; if (Equals(Grid_HookPalette, sender)) { ColorARGBHSV.S = _xPalette / 255d; ColorARGBHSV.V = 1 - _yPalette / 255d; } TextBox_ColorHex.Text = string.Format("{0}", ColorARGBHSV.StringHex); TextBox_ColorAlpha.Text = string.Format("{0}", ColorARGBHSV.A); TextBox_ColorRed.Text = string.Format("{0}", ColorARGBHSV.R); TextBox_ColorGreen.Text = string.Format("{0}", ColorARGBHSV.G); TextBox_ColorBlue.Text = string.Format("{0}", ColorARGBHSV.B); TextBox_ColorHue.Text = string.Format("{0}", (int)Math.Round(ColorARGBHSV.H * 359)); TextBox_ColorSaturation.Text = string.Format("{0}", (int)Math.Round(ColorARGBHSV.S * 100)); TextBox_ColorValue.Text = string.Format("{0}", (int)Math.Round(ColorARGBHSV.V * 100)); if (Equals(Grid_HookBar, sender) || Equals(TextBox_ColorHex, sender) || Equals(TextBox_ColorRed, sender) || Equals(TextBox_ColorGreen, sender) || Equals(TextBox_ColorBlue, sender) || Equals(TextBox_ColorHue, sender) || sender == null) { SetPointerBar((int)Math.Round(ColorARGBHSV.H * 255)); DrawPaletteByHue(ColorARGBHSV.H); } SetPointerPalette((int)Math.Round(ColorARGBHSV.S * 255), 255 - (int)Math.Round(ColorARGBHSV.V * 255)); SetColor(ColorARGBHSV.A, ColorARGBHSV.R, ColorARGBHSV.G, ColorARGBHSV.B); }
private void _SyncState(object sender) { if (Equals(TextBox_ColorHex, sender)) { ColorARGBHSV = ColorARGBHSV.FromStringHex(GetTextBoxHex()); } if (Equals(TextBox_ColorAlpha, sender)) { ColorARGBHSV.A = GetTextBoxAlpha(); } if (Equals(TextBox_ColorRed, sender)) { ColorARGBHSV.R = GetTextBoxRed(); } if (Equals(TextBox_ColorGreen, sender)) { ColorARGBHSV.G = GetTextBoxGreen(); } if (Equals(TextBox_ColorBlue, sender)) { ColorARGBHSV.B = GetTextBoxBlue(); } if (Equals(TextBox_ColorHue, sender)) { ColorARGBHSV.H = GetTextBoxHue(); } if (Equals(TextBox_ColorSaturation, sender)) { ColorARGBHSV.S = GetTextBoxSaturation(); } if (Equals(TextBox_ColorValue, sender)) { ColorARGBHSV.V = GetTextBoxValue(); } if (Equals(Grid_HookBar, sender)) { ColorARGBHSV.H = _yBar / 255d; } if (Equals(Grid_HookPalette, sender)) { ColorARGBHSV.S = _xPalette / 255d; ColorARGBHSV.V = 1 - _yPalette / 255d; } TextBox_ColorHex.Text = string.Format("{0}", ColorARGBHSV.StringHex); TextBox_ColorAlpha.Text = string.Format("{0}", ColorARGBHSV.A); TextBox_ColorRed.Text = string.Format("{0}", ColorARGBHSV.R); TextBox_ColorGreen.Text = string.Format("{0}", ColorARGBHSV.G); TextBox_ColorBlue.Text = string.Format("{0}", ColorARGBHSV.B); TextBox_ColorHue.Text = string.Format("{0}", (int)Math.Round(ColorARGBHSV.H * 359)); TextBox_ColorSaturation.Text = string.Format("{0}", (int)Math.Round(ColorARGBHSV.S * 100)); TextBox_ColorValue.Text = string.Format("{0}", (int)Math.Round(ColorARGBHSV.V * 100)); if (Equals(Grid_HookBar, sender) || Equals(TextBox_ColorHex, sender) || Equals(TextBox_ColorRed, sender) || Equals(TextBox_ColorGreen, sender) || Equals(TextBox_ColorBlue, sender) || Equals(TextBox_ColorHue, sender) || sender == null) { SetPointerBar((int)Math.Round(ColorARGBHSV.H * 255)); DrawPaletteByHue(ColorARGBHSV.H); } SetPointerPalette((int)Math.Round(ColorARGBHSV.S * 255), 255 - (int)Math.Round(ColorARGBHSV.V * 255)); SetColor(ColorARGBHSV.A, ColorARGBHSV.R, ColorARGBHSV.G, ColorARGBHSV.B); }