/// <summary> /// Initializes a new instance of the <see cref="HSVColorPicker"/> class. /// </summary> /// <param name="parent">Parent control.</param> public HSVColorPicker(Base parent) : base(parent) { MouseInputEnabled = true; SetSize(256, 128); //ShouldCacheToTexture = true; m_LerpBox = new ColorLerpBox(this); m_LerpBox.ColorChanged += ColorBoxChanged; m_LerpBox.Dock = Pos.Left; m_ColorSlider = new ColorSlider(this); m_ColorSlider.SetPosition(m_LerpBox.Width + 15, 5); m_ColorSlider.ColorChanged += ColorSliderChanged; m_ColorSlider.Dock = Pos.Left; m_After = new ColorDisplay(this); m_After.SetSize(48, 24); m_After.SetPosition(m_ColorSlider.X + m_ColorSlider.Width + 15, 5); m_Before = new ColorDisplay(this); m_Before.SetSize(48, 24); m_Before.SetPosition(m_After.X, 28); int x = m_Before.X; int y = m_Before.Y + 30; { Label label = new Label(this); label.SetText("R:"); label.SizeToContents(); label.SetPosition(x, y); TextBoxNumeric numeric = new TextBoxNumeric(this); numeric.Name = "RedBox"; numeric.SetPosition(x + 15, y - 1); numeric.SetSize(26, 16); numeric.SelectAllOnFocus = true; numeric.TextChanged += NumericTyped; } y += 20; { Label label = new Label(this); label.SetText("G:"); label.SizeToContents(); label.SetPosition(x, y); TextBoxNumeric numeric = new TextBoxNumeric(this); numeric.Name = "GreenBox"; numeric.SetPosition(x + 15, y - 1); numeric.SetSize(26, 16); numeric.SelectAllOnFocus = true; numeric.TextChanged += NumericTyped; } y += 20; { Label label = new Label(this); label.SetText("B:"); label.SizeToContents(); label.SetPosition(x, y); TextBoxNumeric numeric = new TextBoxNumeric(this); numeric.Name = "BlueBox"; numeric.SetPosition(x + 15, y - 1); numeric.SetSize(26, 16); numeric.SelectAllOnFocus = true; numeric.TextChanged += NumericTyped; } SetColor(DefaultColor); }
/// <summary> /// Initializes a new instance of the <see cref="HSVColorPicker"/> class. /// </summary> /// <param name="parent">Parent control.</param> public HSVColorPicker(ControlBase parent) : base(parent) { MouseInputEnabled = true; SetSize(256, 128); //ShouldCacheToTexture = true; m_LerpBox = new ColorLerpBox(this); m_LerpBox.ColorChanged += ColorBoxChanged; m_LerpBox.Dock = Pos.Left; m_ColorSlider = new ColorSlider(this); m_ColorSlider.SetPosition(m_LerpBox.Width + 15, 5); m_ColorSlider.ColorChanged += ColorSliderChanged; m_ColorSlider.Dock = Pos.Left; m_After = new ColorDisplay(this); m_After.SetSize(48, 24); m_After.SetPosition(m_ColorSlider.X + m_ColorSlider.Width + 15, 5); m_Before = new ColorDisplay(this); m_Before.SetSize(48, 24); m_Before.SetPosition(m_After.X, 28); int x = m_Before.X; int y = m_Before.Y + 30; { Label label = new Label(this); label.SetText("R:"); label.SizeToContents(); label.SetPosition(x, y); TextBoxNumeric numeric = new TextBoxNumeric(this); numeric.Name = "RedBox"; numeric.SetPosition(x + 15, y - 1); numeric.SetSize(26, 16); numeric.SelectAllOnFocus = true; numeric.TextChanged += NumericTyped; } y += 20; { Label label = new Label(this); label.SetText("G:"); label.SizeToContents(); label.SetPosition(x, y); TextBoxNumeric numeric = new TextBoxNumeric(this); numeric.Name = "GreenBox"; numeric.SetPosition(x + 15, y - 1); numeric.SetSize(26, 16); numeric.SelectAllOnFocus = true; numeric.TextChanged += NumericTyped; } y += 20; { Label label = new Label(this); label.SetText("B:"); label.SizeToContents(); label.SetPosition(x, y); TextBoxNumeric numeric = new TextBoxNumeric(this); numeric.Name = "BlueBox"; numeric.SetPosition(x + 15, y - 1); numeric.SetSize(26, 16); numeric.SelectAllOnFocus = true; numeric.TextChanged += NumericTyped; } SetColor(DefaultColor); }
/// <summary> /// Initializes a new instance of the <see cref="HSVColorPicker"/> class. /// </summary> /// <param name="parent">Parent control.</param> public HSVColorPicker(ControlBase parent) : base(parent) { MouseInputEnabled = true; int baseSize = BaseUnit; m_LerpBox = new ColorLerpBox(this); m_LerpBox.Margin = Margin.Two; m_LerpBox.ColorChanged += ColorBoxChanged; m_LerpBox.Dock = Dock.Fill; ControlBase values = new VerticalLayout(this); values.Dock = Dock.Right; { m_After = new ColorDisplay(values); m_After.Size = new Size(baseSize * 5, baseSize * 2); m_Before = new ColorDisplay(values); m_Before.Margin = new Margin(2, 0, 2, 2); m_Before.Size = new Size(baseSize * 5, baseSize * 2); GridLayout grid = new GridLayout(values); grid.Margin = new Margin(2, 0, 2, 2); grid.SetColumnWidths(GridLayout.AutoSize, GridLayout.Fill); { { Label label = new Label(grid); label.Text = "R: "; label.Alignment = Alignment.Left | Alignment.CenterV; m_Red = new NumericUpDown(grid); m_Red.Min = 0; m_Red.Max = 255; m_Red.SelectAllOnFocus = true; m_Red.ValueChanged += NumericTyped; } { Label label = new Label(grid); label.Text = "G: "; label.Alignment = Alignment.Left | Alignment.CenterV; m_Green = new NumericUpDown(grid); m_Green.Min = 0; m_Green.Max = 255; m_Green.SelectAllOnFocus = true; m_Green.ValueChanged += NumericTyped; } { Label label = new Label(grid); label.Text = "B: "; label.Alignment = Alignment.Left | Alignment.CenterV; m_Blue = new NumericUpDown(grid); m_Blue.Min = 0; m_Blue.Max = 255; m_Blue.SelectAllOnFocus = true; m_Blue.ValueChanged += NumericTyped; } } } m_ColorSlider = new ColorSlider(this); m_ColorSlider.Margin = Margin.Two; m_ColorSlider.ColorChanged += ColorSliderChanged; m_ColorSlider.Dock = Dock.Right; EnableDefaultColor = false; SetColor(DefaultColor); }