public ColorPickerForm(ColorPicker owner) { _owner = owner; Size = new Size(188, 264); Location = new Point( Screen.PrimaryScreen.WorkingArea.Width / 2 - Width / 2, Screen.PrimaryScreen.WorkingArea.Height / 2 - Height / 2); Resizable = false; Text = "Pick a color"; TopMost = true; _bsPicker = new BrightnessSaturationPicker(128, 128); _bsPicker.Location = new Point(16, 24); _bsPicker.BrightnessChanged += _bsPicker_BrightnessChanged; _bsPicker.SaturationChanged += _bsPicker_SaturationChanged; Controls.Add(_bsPicker); _huePicker = new HuePicker(20, 128); _huePicker.Location = new Point(_bsPicker.Location.X + _bsPicker.Width + 8, _bsPicker.Location.Y); _huePicker.HueChanged += _huePicker_HueChanged; Controls.Add(_huePicker); _hLabel = new Label(); _hLabel.Text = "H:"; _hLabel.Location = new Point(_bsPicker.Location.X, _bsPicker.Location.Y + _bsPicker.Height + 8); _sLabel = new Label(); _sLabel.Text = "S:"; _sLabel.Location = new Point(_hLabel.Location.X, _hLabel.Location.Y + 22); _lLabel = new Label(); _lLabel.Text = "L:"; _lLabel.Location = new Point(_hLabel.Location.X, _sLabel.Location.Y + 22); Controls.Add(_hLabel); Controls.Add(_sLabel); Controls.Add(_lLabel); _hNumeric = new NumericUpDown(); _hNumeric.Minimum = 0; _hNumeric.Maximum = 360; _hNumeric.Location = new Point(_hLabel.Location.X + 24, _hLabel.Location.Y); _hNumeric.Size = new Drawing.Size(50, 20); _hNumeric.ValueChanged += _hNumeric_ValueChanged; _hNumeric.TextAlign = HorizontalAlignment.Center; _sNumeric = new NumericUpDown(); _sNumeric.Minimum = 0; _sNumeric.Maximum = 255; _sNumeric.Location = new Point(_sLabel.Location.X + 24, _sLabel.Location.Y); _sNumeric.Size = new Drawing.Size(50, 20); _sNumeric.ValueChanged += _sNumeric_ValueChanged; _sNumeric.TextAlign = HorizontalAlignment.Center; _lNumeric = new NumericUpDown(); _lNumeric.Minimum = 0; _lNumeric.Maximum = 255; _lNumeric.Location = new Point(_lLabel.Location.X + 24, _lLabel.Location.Y); _lNumeric.Size = new Drawing.Size(50, 20); _lNumeric.ValueChanged += _lNumeric_ValueChanged; _lNumeric.TextAlign = HorizontalAlignment.Center; Controls.Add(_hNumeric); Controls.Add(_sNumeric); Controls.Add(_lNumeric); _rLabel = new Label(); _rLabel.Text = "R:"; _rLabel.Location = new Point(_hNumeric.Location.X + _hNumeric.Width + 8, _hLabel.Location.Y); _gLabel = new Label(); _gLabel.Text = "G:"; _gLabel.Location = new Point(_rLabel.Location.X, _sLabel.Location.Y); _bLabel = new Label(); _bLabel.Text = "B:"; _bLabel.Location = new Point(_rLabel.Location.X, _lLabel.Location.Y); Controls.Add(_rLabel); Controls.Add(_gLabel); Controls.Add(_bLabel); _rNumeric = new NumericUpDown(); _rNumeric.Minimum = 0; _rNumeric.Maximum = 255; _rNumeric.Location = new Point(_rLabel.Location.X + 24, _rLabel.Location.Y); _rNumeric.Size = new Size(50, 20); _rNumeric.TextAlign = HorizontalAlignment.Center; _rNumeric.ValueChanged += _rNumeric_ValueChanged; _gNumeric = new NumericUpDown(); _gNumeric.Minimum = 0; _gNumeric.Maximum = 255; _gNumeric.Location = new Point(_gLabel.Location.X + 24, _gLabel.Location.Y); _gNumeric.Size = new Drawing.Size(50, 20); _gNumeric.TextAlign = HorizontalAlignment.Center; _gNumeric.ValueChanged += _gNumeric_ValueChanged; _bNumeric = new NumericUpDown(); _bNumeric.Minimum = 0; _bNumeric.Maximum = 255; _bNumeric.Location = new Point(_bLabel.Location.X + 24, _bLabel.Location.Y); _bNumeric.Size = new Drawing.Size(50, 20); _bNumeric.TextAlign = HorizontalAlignment.Center; _bNumeric.ValueChanged += _bNumeric_ValueChanged; Controls.Add(_rNumeric); Controls.Add(_gNumeric); Controls.Add(_bNumeric); _alphaPicker = new AlphaPicker(_lNumeric.Location.X + _lNumeric.Width - _lLabel.Location.X, 20); _alphaPicker.Location = new Point(_lLabel.Location.X, _lLabel.Location.Y + 26); _alphaPicker.AlphaChanged += _alphaPicker_AlphaChanged; _aLabel = new Label(); _aLabel.Location = new Point(_bLabel.Location.X, _alphaPicker.Location.Y); _aLabel.Text = "A:"; _aNumeric = new NumericUpDown(); _aNumeric.Minimum = 0; _aNumeric.Maximum = 255; _aNumeric.Value = 255; _aNumeric.Location = new Point(_bNumeric.Location.X, _aLabel.Location.Y); _aNumeric.Size = new Drawing.Size(50, 20); _aNumeric.TextAlign = HorizontalAlignment.Center; _aNumeric.ValueChanged += _aNumeric_ValueChanged; Controls.Add(_alphaPicker); Controls.Add(_aLabel); Controls.Add(_aNumeric); }
public ColorPickerForm(ColorPicker owner) { _owner = owner; Size = new Size(188, 264); Location = new Point( Screen.PrimaryScreen.WorkingArea.Width / 2 - Width / 2, Screen.PrimaryScreen.WorkingArea.Height / 2 - Height / 2); Resizable = false; Text = "Pick a color"; TopMost = true; _bsPicker = new BrightnessSaturationPicker(128, 128); _bsPicker.Location = new Point(16, 24); _bsPicker.BrightnessChanged += _bsPicker_BrightnessChanged; _bsPicker.SaturationChanged += _bsPicker_SaturationChanged; Controls.Add(_bsPicker); _huePicker = new HuePicker(20, 128); _huePicker.Location = new Point(_bsPicker.Location.X + _bsPicker.Width + 8, _bsPicker.Location.Y); _huePicker.HueChanged += _huePicker_HueChanged; Controls.Add(_huePicker); _hLabel = new Label(); _hLabel.Text = "H:"; _hLabel.Location = new Point(_bsPicker.Location.X, _bsPicker.Location.Y + _bsPicker.Height + 8); _sLabel = new Label(); _sLabel.Text = "S:"; _sLabel.Location = new Point(_hLabel.Location.X, _hLabel.Location.Y + 22); _lLabel = new Label(); _lLabel.Text = "L:"; _lLabel.Location = new Point(_hLabel.Location.X, _sLabel.Location.Y + 22); Controls.Add(_hLabel); Controls.Add(_sLabel); Controls.Add(_lLabel); _hNumeric = new NumericUpDown(); _hNumeric.Minimum = 0; _hNumeric.Maximum = 360; _hNumeric.Location = new Point(_hLabel.Location.X + 24, _hLabel.Location.Y); _hNumeric.Size = new Drawing.Size(50, 20); _hNumeric.ValueChanged += _hNumeric_ValueChanged; _hNumeric.TextAlign = HorizontalAlignment.Center; _sNumeric = new NumericUpDown(); _sNumeric.Minimum = 0; _sNumeric.Maximum = 255; _sNumeric.Location = new Point(_sLabel.Location.X + 24, _sLabel.Location.Y); _sNumeric.Size = new Drawing.Size(50, 20); _sNumeric.ValueChanged += _sNumeric_ValueChanged; _sNumeric.TextAlign = HorizontalAlignment.Center; _lNumeric = new NumericUpDown(); _lNumeric.Minimum = 0; _lNumeric.Maximum = 255; _lNumeric.Location = new Point(_lLabel.Location.X + 24, _lLabel.Location.Y); _lNumeric.Size = new Drawing.Size(50, 20); _lNumeric.ValueChanged += _lNumeric_ValueChanged; _lNumeric.TextAlign = HorizontalAlignment.Center; Controls.Add(_hNumeric); Controls.Add(_sNumeric); Controls.Add(_lNumeric); _rLabel = new Label(); _rLabel.Text = "R:"; _rLabel.Location = new Point(_hNumeric.Location.X + _hNumeric.Width + 8, _hLabel.Location.Y); _gLabel = new Label(); _gLabel.Text = "G:"; _gLabel.Location = new Point(_rLabel.Location.X, _sLabel.Location.Y); _bLabel = new Label(); _bLabel.Text = "B:"; _bLabel.Location = new Point(_rLabel.Location.X, _lLabel.Location.Y); Controls.Add(_rLabel); Controls.Add(_gLabel); Controls.Add(_bLabel); _rNumeric = new NumericUpDown(); _rNumeric.Minimum = 0; _rNumeric.Maximum = 255; _rNumeric.Location = new Point(_rLabel.Location.X + 24, _rLabel.Location.Y); _rNumeric.Size = new Size(50, 20); _rNumeric.TextAlign = HorizontalAlignment.Center; _rNumeric.ValueChanged += _rNumeric_ValueChanged; _gNumeric = new NumericUpDown(); _gNumeric.Minimum = 0; _gNumeric.Maximum = 255; _gNumeric.Location = new Point(_gLabel.Location.X + 24, _gLabel.Location.Y); _gNumeric.Size = new Drawing.Size(50, 20); _gNumeric.TextAlign = HorizontalAlignment.Center; _gNumeric.ValueChanged += _gNumeric_ValueChanged; _bNumeric = new NumericUpDown(); _bNumeric.Minimum = 0; _bNumeric.Maximum = 255; _bNumeric.Location = new Point(_bLabel.Location.X + 24, _bLabel.Location.Y); _bNumeric.Size = new Drawing.Size(50, 20); _bNumeric.TextAlign = HorizontalAlignment.Center; _bNumeric.ValueChanged += _bNumeric_ValueChanged; Controls.Add(_rNumeric); Controls.Add(_gNumeric); Controls.Add(_bNumeric); _alphaPicker = new AlphaPicker(_lNumeric.Location.X + _lNumeric.Width - _lLabel.Location.X, 20); _alphaPicker.Location = new Point(_lLabel.Location.X, _lLabel.Location.Y + 26); _alphaPicker.AlphaChanged += _alphaPicker_AlphaChanged; _aLabel = new Label(); _aLabel.Location = new Point(_bLabel.Location.X, _alphaPicker.Location.Y); _aLabel.Text = "A:"; _aNumeric = new NumericUpDown(); _aNumeric.Minimum = 0; _aNumeric.Maximum = 255; _aNumeric.Value = 255; _aNumeric.Location = new Point(_bNumeric.Location.X, _aLabel.Location.Y); _aNumeric.Size = new Drawing.Size(50, 20); _aNumeric.TextAlign = HorizontalAlignment.Center; _aNumeric.ValueChanged += _aNumeric_ValueChanged; Controls.Add(_alphaPicker); Controls.Add(_aLabel); Controls.Add(_aNumeric); }