private void btnMore_Click(object sender, EventArgs e) { if (this.btnMore.Text == "More =>") { this.btnMore.Text = "<= Less"; this.colorPickerMultiEx1 = new ColorPickerMultiEx(); this.colorPickerMultiEx1.ColorChanged += new EventHandler(colorPickerMultiEx1_ColorChanged); this.Controls.Add(this.colorPickerMultiEx1); this.colorPickerMultiEx1.ColorObject = this.ColorObject; this.colorPickerMultiEx1.Location = new Point(this.btnMore.Right + 4, 0); this.Width += this.colorPickerMultiEx1.Width; //this.btnMore.Top = this.colorPickerMultiEx1.Bottom - this.btnMore.Height; int dragbarHeight = this.Height - this.ClientRectangle.Height; this.Height = this.colorPickerMultiEx1.Bottom + 3 + dragbarHeight; } else { this.btnMore.Text = "More =>"; this.Width -= this.colorPickerMultiEx1.Width; this.colorPickerMultiEx1.Dispose(); this.colorPickerMultiEx1 = null; //this.btnMore.Top = this.tbColorText.Bottom - this.btnMore.Height; int dragbarHeight = this.Height - this.ClientRectangle.Height; this.Height = this.tbColorText.Bottom + 3 + dragbarHeight; } }
public void SetColorType(Type type) { if (this.colorPickerMulti1.ColorObject != null && this.colorPickerMulti1.ColorObject.GetType() == type) return; System.Reflection.ConstructorInfo ci = type.GetConstructor(new Type[]{}); Endogine.ColorEx.ColorBase clr = (Endogine.ColorEx.ColorBase)ci.Invoke(new object[] { }); if (clr.GetAxisInfo().Length > 3) { //TODO: can't handle 4-dimensional spaces ATM - add another slider! return; } if (this.colorPickerMulti1.ColorObject == null) clr.Vector = new Endogine.Vector4(1, 0, 0, 0); else clr.RgbFloat = this.colorPickerMulti1.ColorObject.RgbFloat; this.colorPickerMulti1.ColorObject = clr; this.comboSliderAxis.Items.Clear(); Endogine.ColorEx.ColorBase.AxisInfo[] infos = clr.GetAxisInfo(); foreach (Endogine.ColorEx.ColorBase.AxisInfo info in infos) { this.comboSliderAxis.Items.Add(info.Name); } this.comboSliderAxis.SelectedIndex = 0; }
public ColorBase Copy() { System.Reflection.ConstructorInfo ci = this.GetType().GetConstructor(new Type[] { }); ColorBase obj = (ColorBase)ci.Invoke(new object[] { }); obj.Vector = this.Vector.Copy(); return(obj); }
private void SetFromColorTextBox() { try { Endogine.ColorEx.ColorRgb clr = new Endogine.ColorEx.ColorRgb(this.tbColorText.Text); this.colorPickerPainter1.ColorObject = clr; this.UpdateAllExcept("ColorTextBox"); } catch { } }
public void SetColorType(Type type) { if (this.colorPickerMulti1.ColorObject != null && this.colorPickerMulti1.ColorObject.GetType() == type) { return; } System.Reflection.ConstructorInfo ci = type.GetConstructor(new Type[] {}); Endogine.ColorEx.ColorBase clr = (Endogine.ColorEx.ColorBase)ci.Invoke(new object[] { }); if (clr.GetAxisInfo().Length > 3) { //TODO: can't handle 4-dimensional spaces ATM - add another slider! return; } if (this.colorPickerMulti1.ColorObject == null) { clr.Vector = new Endogine.Vector4(1, 0, 0, 0); } else { clr.RgbFloat = this.colorPickerMulti1.ColorObject.RgbFloat; } this.colorPickerMulti1.ColorObject = clr; this.comboSliderAxis.Items.Clear(); Endogine.ColorEx.ColorBase.AxisInfo[] infos = clr.GetAxisInfo(); foreach (Endogine.ColorEx.ColorBase.AxisInfo info in infos) { this.comboSliderAxis.Items.Add(info.Name); } this.comboSliderAxis.SelectedIndex = 0; }
private void comboColorSpace_SelectedIndexChanged(object sender, EventArgs e) { Type test = typeof(Endogine.ColorEx.ColorBase); string sType = test.AssemblyQualifiedName; string space = (string)((ComboBox)sender).SelectedItem; sType = sType.Replace("ColorBase", "Color" + space); Type type = Type.GetType(sType, true, true); //("Endogine.ColorEx.Color" + space ColorBase clr = this.ColorObject; this.SetColorType(type); this.ColorObject = clr; }
public ColorGradientChip CreateChip(ColorBase color, float position) { ColorGradientChip chip = new ColorGradientChip(); this.Controls.Add(chip); chip.Size = this._chipSize; chip.Location = new Point(30, this.panel1.Bottom); this._colorChips.Add(chip); chip.ColorObject = color; chip.Position = position; chip.Dragged += new EventHandler(chip_Dragged); chip.ColorChanged += new EventHandler(chip_ColorChanged); chip.Removed += new EventHandler(chip_Removed); return chip; }
private void colorPickerMultiEx1_ColorChanged(object sender, EventArgs e) { this.colorPickerPainter1.ColorObject = this.colorPickerMultiEx1.ColorObject; this.UpdateAllExcept("Multi"); }
private void btnMore_Click(object sender, EventArgs e) { if (this.btnMore.Text == "More =>") { this.btnMore.Text = "<= Less"; this.colorPickerMultiEx1 = new ColorPickerMultiEx(); this.colorPickerMultiEx1.ColorChanged+=new EventHandler(colorPickerMultiEx1_ColorChanged); this.Controls.Add(this.colorPickerMultiEx1); this.colorPickerMultiEx1.ColorObject = this.ColorObject; this.colorPickerMultiEx1.Location = new Point(this.btnMore.Right + 4, 0); this.Width += this.colorPickerMultiEx1.Width; //this.btnMore.Top = this.colorPickerMultiEx1.Bottom - this.btnMore.Height; int dragbarHeight = this.Height - this.ClientRectangle.Height; this.Height = this.colorPickerMultiEx1.Bottom + 3 + dragbarHeight; } else { this.btnMore.Text = "More =>"; this.Width -= this.colorPickerMultiEx1.Width; this.colorPickerMultiEx1.Dispose(); this.colorPickerMultiEx1 = null; //this.btnMore.Top = this.tbColorText.Bottom - this.btnMore.Height; int dragbarHeight = this.Height - this.ClientRectangle.Height; this.Height = this.tbColorText.Bottom + 3 + dragbarHeight; } }
private void UpdateAllExcept(string exceptWhat) { if (exceptWhat == null) exceptWhat = ""; //Color clr = this.colorPickerPainter1.Color; ColorBase clr = this.colorPickerPainter1.ColorObject; clr.Validate(); this.colorChip1.ColorObject = clr; if (exceptWhat.IndexOf("Alpha") < 0) this.numAlpha.Value = clr.A; if (exceptWhat.IndexOf("RGB") < 0) { //if (clr is ColorRgb) // this.colorNumericRGB.ColorObject = clr; //else this.colorNumericRGB.ColorObject = new ColorRgb(clr.RgbFloat); } if (exceptWhat.IndexOf("HSB") < 0) { if (clr is ColorHsb) this.colorNumericHSB.ColorObject = clr; else this.colorNumericHSB.ColorObject = new ColorHsb(clr.RgbFloat); } if (exceptWhat.IndexOf("Multi") < 0 && this.colorPickerMultiEx1 != null) this.colorPickerMultiEx1.ColorObject = clr; if (exceptWhat.IndexOf("ColorTextBox") < 0) { this.updateFromTextBox = false; Endogine.ColorEx.ColorRgb rgb = new Endogine.ColorEx.ColorRgb(clr.ColorRGBA); this.tbColorText.Text = rgb.ToString("X"); this.updateFromTextBox = true; } if (exceptWhat.IndexOf("Event") < 0) if (this.ColorChanged != null) this.ColorChanged(this, null); }
void numAlpha_ValueChanged(object sender, EventArgs e) { ColorBase clr = this.colorPickerPainter1.ColorObject; clr.A = (int)this.numAlpha.Value; this.colorPickerPainter1.ColorObject = clr; this.UpdateAllExcept("Alpha"); }
void colorNumericRGB_ColorChanged(object sender, EventArgs e) { this.colorPickerPainter1.ColorObject = this.colorNumericRGB.ColorObject; this.UpdateAllExcept("RGB"); }
void form_ColorChanged(object sender, EventArgs e) { this.ColorObject = ((ColorPickerForm)sender).ColorObject; if (this.ColorChanged != null) this.ColorChanged(this, null); }
private void InsertAtNoUpdate(int index, string name, ColorBase color) { Swatch s = new Swatch(); s.BorderStyle = BorderStyle.FixedSingle; this.Controls.Add(s); if (color != null) s.Color = color; s.Name = name; s.MouseDown += new MouseEventHandler(s_MouseDown); s.MouseMove += new MouseEventHandler(s_MouseMove); s.MouseUp += new MouseEventHandler(s_MouseUp); this._swatches.Add(color, s); }