// ********************************************************************* // InitializeControlTemplate // /// <summary> /// Initializes the user control loaded in CreateChildControls. Initialization /// consists of finding well known control names and wiring up any necessary events. /// </summary> /// // ********************************************************************/ private void InitializeControlTemplate() { // Find the picker control picker = (AlphaPicker)controlTemplate.FindControl("AlphaPicker"); // Find the user list control userList = (UserList)controlTemplate.FindControl("UserList"); }
public ColorPickerForm() { borderPen = new Pen(Color.FromArgb(204, 206, 219)); BackColor = Color.White; Size = new Size(188, 272); Location = new Point( Screen.PrimaryScreen.WorkingArea.Width / 2 - Width / 2, Screen.PrimaryScreen.WorkingArea.Height / 2 - Height / 2); FormBorderStyle = FormBorderStyle.FixedSingle; Text = "Pick a color"; KeyPreview = true; TopMost = true; vsPicker = new ValueSaturationPicker(128, 128); vsPicker.Location = new Point(16, 32); vsPicker.ValueChanged += VsPickerValueChanged; vsPicker.SaturationChanged += VsPickerSaturationChanged; Controls.Add(vsPicker); huePicker = new HuePicker(20, 128); huePicker.Location = new Point(vsPicker.Location.X + vsPicker.Width + 8, vsPicker.Location.Y); huePicker.HueChanged += huePicker_HueChanged; Controls.Add(huePicker); var hueLabel = new Label(); hueLabel.Text = "H:"; hueLabel.Location = new Point(vsPicker.Location.X, vsPicker.Location.Y + vsPicker.Height + 8); var saturationLabel = new Label(); saturationLabel.Text = "S:"; saturationLabel.Location = new Point(hueLabel.Location.X, hueLabel.Location.Y + 22); var valueLabel = new Label(); valueLabel.Text = "V:"; valueLabel.Location = new Point(hueLabel.Location.X, saturationLabel.Location.Y + 22); Controls.Add(hueLabel); Controls.Add(saturationLabel); Controls.Add(valueLabel); hueNumeric = new NumericUpDown(); hueNumeric.Minimum = 0; hueNumeric.Maximum = 359; hueNumeric.Increment = 5; hueNumeric.Location = new Point(hueLabel.Location.X + 24, hueLabel.Location.Y); hueNumeric.Size = new Size(50, 20); hueNumeric.ValueChanged += HueNumericValueChanged; hueNumeric.TextAlign = HorizontalAlignment.Center; saturationNumeric = new NumericUpDown(); saturationNumeric.Minimum = 0; saturationNumeric.Maximum = 255; saturationNumeric.Location = new Point(saturationLabel.Location.X + 24, saturationLabel.Location.Y); saturationNumeric.Size = new Size(50, 20); saturationNumeric.ValueChanged += SaturationNumericValueChanged; saturationNumeric.TextAlign = HorizontalAlignment.Center; valueNumeric = new NumericUpDown(); valueNumeric.Minimum = 0; valueNumeric.Maximum = 255; valueNumeric.Location = new Point(valueLabel.Location.X + 24, valueLabel.Location.Y); valueNumeric.Size = new Size(50, 20); valueNumeric.ValueChanged += ValueNumericValueChanged; valueNumeric.TextAlign = HorizontalAlignment.Center; Controls.Add(hueNumeric); Controls.Add(saturationNumeric); Controls.Add(valueNumeric); var rLabel = new Label(); rLabel.Text = "R:"; rLabel.Location = new Point(hueNumeric.Location.X + hueNumeric.Width + 8, hueLabel.Location.Y); var gLabel = new Label(); gLabel.Text = "G:"; gLabel.Location = new Point(rLabel.Location.X, saturationLabel.Location.Y); var bLabel = new Label(); bLabel.Text = "B:"; bLabel.Location = new Point(rLabel.Location.X, valueLabel.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 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 Size(50, 20); bNumeric.TextAlign = HorizontalAlignment.Center; bNumeric.ValueChanged += bNumeric_ValueChanged; Controls.Add(rNumeric); Controls.Add(gNumeric); Controls.Add(bNumeric); alphaPicker = new AlphaPicker(valueNumeric.Location.X + valueNumeric.Width - valueLabel.Location.X, 20); alphaPicker.Location = new Point(valueLabel.Location.X, valueLabel.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 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); }
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); }