private void UpdateSelectedColorFromPanelValue() { Color tmp; switch (_primAttrib) { default: _selColor.S = colorPanel.ValuePercentual.X; _selColor.V = colorPanel.ValuePercentual.Y; break; case PrimaryAttrib.Saturation: _selColor.H = colorPanel.ValuePercentual.X; _selColor.V = colorPanel.ValuePercentual.Y; break; case PrimaryAttrib.Brightness: _selColor.H = colorPanel.ValuePercentual.X; _selColor.S = colorPanel.ValuePercentual.Y; break; case PrimaryAttrib.Red: tmp = _selColor.ToColor(); _selColor = new InternalColor(Color.FromArgb( tmp.A, tmp.R, (int)Math.Round(colorPanel.ValuePercentual.Y * 255.0f), (int)Math.Round(colorPanel.ValuePercentual.X * 255.0f))); break; case PrimaryAttrib.Green: tmp = _selColor.ToColor(); _selColor = new InternalColor(Color.FromArgb( tmp.A, (int)Math.Round(colorPanel.ValuePercentual.Y * 255.0f), tmp.G, (int)Math.Round(colorPanel.ValuePercentual.X * 255.0f))); break; case PrimaryAttrib.Blue: tmp = _selColor.ToColor(); _selColor = new InternalColor(Color.FromArgb( tmp.A, (int)Math.Round(colorPanel.ValuePercentual.Y * 255.0f), (int)Math.Round(colorPanel.ValuePercentual.X * 255.0f), tmp.B)); break; } if (ColorChanged != null) { ColorChanged(this, EventArgs.Empty); } }
private void UpdateColorShowBox() { colorShowBox.UpperColor = _alphaEnabled ? _oldColor.ToColor() : Color.FromArgb(255, _oldColor.ToColor()); colorShowBox.LowerColor = _alphaEnabled ? _selColor.ToColor() : Color.FromArgb(255, _selColor.ToColor()); }
private void UpdateText() { Color tmp = _selColor.ToColor(); _suspendTextEvents = true; textBoxHex.Text = String.Format("{0:X}", tmp.ToArgb()); numRed.Value = tmp.R; numGreen.Value = tmp.G; numBlue.Value = tmp.B; numAlpha.Value = tmp.A; numHue.Value = (decimal)(_selColor.H * 360.0f); numSaturation.Value = (decimal)(_selColor.S * 100.0f); numValue.Value = (decimal)(_selColor.V * 100.0f); _suspendTextEvents = false; }