public AngleChooserPropertyControl(PropertyControlInfo propInfo) : base(propInfo) { AngleChooserPhase offsetByPi; DoubleProperty property = (DoubleProperty)propInfo.Property; if ((property.MaxValue - property.MinValue) > 360.0) { throw new ArgumentException($"The difference between the property's minimum and maximum values cannot exceed 360.0. (Property.MinValue={property.MinValue}, Property.MaxValue={property.MaxValue}, Delta={property.MaxValue - property.MinValue})"); } double minValue = property.MinValue; double maxValue = property.MaxValue; if ((property.MinValue >= -180.0) && (property.MaxValue <= 180.0)) { offsetByPi = AngleChooserPhase.OffsetByPi; } else { if ((property.MinValue < 0.0) || (property.MaxValue > 360.0)) { throw new ArgumentException($"The property minimum and maximum values must either fall into the range [-180, +180] or [0, +360]. (Property.MinValue={property.MinValue}, Property.MaxValue={property.MaxValue})"); } offsetByPi = AngleChooserPhase.Regular; } this.header = new HeadingLabel(); this.header.Name = "header"; this.header.RightMargin = 0; this.header.Text = base.DisplayName; this.angleChooser = new AngleChooser(); this.angleChooser.Name = "angleChooser"; this.angleChooser.Phase = offsetByPi; this.angleChooser.MinValue = minValue; this.angleChooser.MaxValue = maxValue; this.angleChooser.ValueChanged += new EventHandler(this.OnAngleChooserValueChanged); this.valueNud = new PdnNumericUpDown(); this.valueNud.Name = "numericUpDown"; this.valueNud.Minimum = (decimal)base.Property.MinValue; this.valueNud.Maximum = (decimal)base.Property.MaxValue; this.valueNud.DecimalPlaces = (int)propInfo.ControlProperties[ControlInfoPropertyNames.DecimalPlaces].Value; this.valueNud.ValueChanged += new EventHandler(this.OnValueNudValueChanged); this.valueNud.TextAlign = HorizontalAlignment.Right; if ((maxValue - minValue) == 360.0) { this.valueNud.RangeWraps = true; } this.resetButton = new PdnPushButton(); this.resetButton.Name = "resetButton"; this.resetButton.Click += new EventHandler(this.OnResetButtonClick); this.resetButton.Image = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference; this.resetButton.Visible = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value; base.ToolTip.SetToolTip(this.resetButton, PdnResources.GetString("Form.ResetButton.Text").Replace("&", "")); this.description = new PdnLabel(); this.description.Name = "descriptionText"; this.description.AutoSize = false; this.description.Text = base.Description; base.SuspendLayout(); Control[] controls = new Control[] { this.header, this.angleChooser, this.valueNud, this.resetButton, this.description }; base.Controls.AddRange(controls); base.ResumeLayout(false); }
public VectorSliderPropertyControl(PropertyControlInfo propInfo) : base(propInfo) { this.decimalPlaces = 2; base.SuspendLayout(); this.header = new HeadingLabel(); this.sliderX = new PdnTrackBar(); this.numericUpDownX = new PdnNumericUpDown(); this.resetButtonX = new PdnPushButton(); this.sliderY = new PdnTrackBar(); this.numericUpDownY = new PdnNumericUpDown(); this.resetButtonY = new PdnPushButton(); this.descriptionText = new PdnLabel(); this.header.Name = "header"; this.header.RightMargin = 0; this.header.Text = base.DisplayName; this.sliderX.Name = "sliderX"; this.sliderX.AutoSize = false; this.sliderX.ValueChanged += new EventHandler(this.OnSliderXValueChanged); this.SliderShowTickMarksX = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.SliderShowTickMarksX].Value; this.sliderX.ResetRequested += new EventHandler(this.OnResetButtonXClick); this.numericUpDownX.Name = "numericUpDownX"; this.numericUpDownX.ValueChanged += new EventHandler(this.OnNumericUpDownXValueChanged); this.numericUpDownX.TextAlign = HorizontalAlignment.Right; this.resetButtonX.Name = "resetButtonX"; this.resetButtonX.AutoSize = false; this.resetButtonX.Click += new EventHandler(this.OnResetButtonXClick); this.resetButtonX.Image = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference; this.resetButtonX.Visible = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value; base.ToolTip.SetToolTip(this.resetButtonX, PdnResources.GetString("Form.ResetButton.Text").Replace("&", "")); this.sliderY.Name = "sliderY"; this.sliderY.AutoSize = false; this.sliderY.ValueChanged += new EventHandler(this.OnSliderYValueChanged); this.SliderShowTickMarksY = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.SliderShowTickMarksY].Value; this.sliderY.ResetRequested += new EventHandler(this.OnResetButtonYClick); this.numericUpDownY.Name = "numericUpDownY"; this.numericUpDownY.ValueChanged += new EventHandler(this.OnNumericUpDownYValueChanged); this.numericUpDownY.TextAlign = HorizontalAlignment.Right; this.resetButtonY.Name = "resetButtonY"; this.resetButtonY.AutoSize = false; this.resetButtonY.Click += new EventHandler(this.OnResetButtonYClick); this.resetButtonY.Image = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference; this.resetButtonY.Visible = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value; base.ToolTip.SetToolTip(this.resetButtonY, PdnResources.GetString("Form.ResetButton.Text").Replace("&", "")); this.descriptionText.Name = "descriptionText"; this.descriptionText.AutoSize = false; this.descriptionText.Text = base.Description; this.ValidateUIRanges(); this.ResetUIRanges(); Control[] controls = new Control[] { this.header, this.sliderX, this.numericUpDownX, this.resetButtonX, this.sliderY, this.numericUpDownY, this.resetButtonY, this.descriptionText }; base.Controls.AddRange(controls); base.ResumeLayout(false); }
public SliderPropertyControl(PropertyControlInfo propInfo) : base(propInfo) { this.header = new HeadingLabel(); this.slider = new PdnTrackBar(); this.numericUpDown = new PdnNumericUpDown(); this.resetButton = new PdnPushButton(); this.descriptionText = new PdnLabel(); this.slider.BeginInit(); base.SuspendLayout(); this.header.Name = "header"; this.header.RightMargin = 0; this.header.Text = base.DisplayName; this.numericUpDown.DecimalPlaces = 0; this.numericUpDown.Name = "numericUpDown"; this.numericUpDown.TextAlign = HorizontalAlignment.Right; this.numericUpDown.TabIndex = 1; this.RangeWraps = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.RangeWraps].Value; this.slider.Name = "slider"; this.slider.AutoSize = false; this.slider.TabIndex = 0; this.SliderShowTickMarks = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.SliderShowTickMarks].Value; this.ControlStyle = (int)propInfo.ControlProperties[ControlInfoPropertyNames.ControlStyle].Value; this.ControlColors = propInfo.ControlProperties[ControlInfoPropertyNames.ControlColors].Value; this.slider.ResetRequested += new EventHandler(this.OnResetButtonClick); this.resetButton.AutoSize = false; this.resetButton.Name = "resetButton"; this.resetButton.Click += new EventHandler(this.OnResetButtonClick); this.resetButton.Image = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference; this.resetButton.TabIndex = 2; this.resetButton.Visible = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value; base.ToolTip.SetToolTip(this.resetButton, PdnResources.GetString("Form.ResetButton.Text").Replace("&", "")); this.descriptionText.Name = "descriptionText"; this.descriptionText.AutoSize = false; this.descriptionText.Text = base.Description; this.ValidateUIRanges(); this.ResetUIRanges(); Control[] controls = new Control[] { this.header, this.slider, this.numericUpDown, this.resetButton, this.descriptionText }; base.Controls.AddRange(controls); this.slider.EndInit(); base.ResumeLayout(false); this.numericUpDown.ValueChanged += new EventHandler(this.OnNumericUpDownValueChanged); this.slider.ValueChanged += new EventHandler(this.OnSliderValueChanged); }
public Int32ColorWheelPropertyControl(PropertyControlInfo propInfo) : base(propInfo) { if (Property.MinValue != requiredMin || Property.MaxValue != requiredMax) { throw new ArgumentException("The only range allowed for this control is [" + requiredMin + ", " + requiredMax + "]"); } SuspendLayout(); this.header = new HeaderLabel(); this.header.Name = "header"; this.header.RightMargin = 0; this.header.Text = this.DisplayName; this.colorRectangle = new ColorRectangleControl(); this.colorRectangle.Name = "colorRectangle"; this.colorRectangle.TabStop = false; this.colorRectangle.TabIndex = 0; this.hsvColorWheel = new ColorWheel(); this.hsvColorWheel.Name = "hsvColorWheel"; this.hsvColorWheel.ColorChanged += new EventHandler(HsvColorWheel_ColorChanged); this.hsvColorWheel.TabStop = false; this.hsvColorWheel.TabIndex = 1; this.saturationSlider = new ColorGradientControl(); this.saturationSlider.Name = "saturationSlider"; this.saturationSlider.Orientation = Orientation.Vertical; this.saturationSlider.ValueChanged += new IndexEventHandler(SaturationSlider_ValueChanged); this.saturationSlider.TabStop = false; this.saturationSlider.TabIndex = 2; this.valueSlider = new ColorGradientControl(); this.valueSlider.Name = "valueSlider"; this.valueSlider.Orientation = Orientation.Vertical; this.valueSlider.ValueChanged += new IndexEventHandler(ValueSlider_ValueChanged); this.valueSlider.TabStop = false; this.valueSlider.TabIndex = 3; this.redLabel = new Label(); this.redLabel.Name = "redLabel"; this.redLabel.AutoSize = true; this.redLabel.Text = PdnResources.GetString("ColorsForm.RedLabel.Text"); this.redNud = new PdnNumericUpDown(); this.redNud.Name = "redNud"; this.redNud.Minimum = 0; this.redNud.Maximum = 255; this.redNud.TextAlign = HorizontalAlignment.Right; this.redNud.ValueChanged += new EventHandler(RedNud_ValueChanged); this.redNud.TabIndex = 4; this.greenLabel = new Label(); this.greenLabel.Name = "greenLabel"; this.greenLabel.AutoSize = true; this.greenLabel.Text = PdnResources.GetString("ColorsForm.GreenLabel.Text"); this.greenNud = new PdnNumericUpDown(); this.greenNud.Name = "greenNud"; this.greenNud.Minimum = 0; this.greenNud.Maximum = 255; this.greenNud.TextAlign = HorizontalAlignment.Right; this.greenNud.ValueChanged += new EventHandler(GreenNud_ValueChanged); this.greenNud.TabIndex = 5; this.blueLabel = new Label(); this.blueLabel.Name = "blueLabel"; this.blueLabel.AutoSize = true; this.blueLabel.Text = PdnResources.GetString("ColorsForm.BlueLabel.Text"); this.blueNud = new PdnNumericUpDown(); this.blueNud.Name = "blueNud"; this.blueNud.Minimum = 0; this.blueNud.Maximum = 255; this.blueNud.TextAlign = HorizontalAlignment.Right; this.blueNud.ValueChanged += new EventHandler(BlueNud_ValueChanged); this.blueNud.TabIndex = 6; this.resetButton = new Button(); this.resetButton.AutoSize = true; this.resetButton.Name = "resetButton"; this.resetButton.FlatStyle = FlatStyle.Standard; this.resetButton.Click += new EventHandler(ResetButton_Click); this.resetButton.Image = PdnResources.GetImage("Icons.ResetIcon.png"); this.resetButton.Width = 1; this.resetButton.Visible = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value; this.ToolTip.SetToolTip(this.resetButton, PdnResources.GetString("Form.ResetButton.Text").Replace("&", "")); this.resetButton.TabIndex = 7; this.description = new Label(); this.description.Name = "description"; this.description.Text = this.Description; this.Controls.AddRange( new Control[] { this.header, this.hsvColorWheel, this.saturationSlider, this.valueSlider, this.colorRectangle, this.redLabel, this.redNud, this.greenLabel, this.greenNud, this.blueLabel, this.blueNud, this.resetButton, this.description }); ResumeLayout(false); }
public SliderPropertyControl(PropertyControlInfo propInfo) : base(propInfo) { this.header = new HeaderLabel(); this.slider = new TrackBar(); this.numericUpDown = new PdnNumericUpDown(); this.resetButton = new Button(); this.descriptionText = new Label(); this.slider.BeginInit(); SuspendLayout(); this.header.Name = "header"; this.header.RightMargin = 0; this.header.Text = this.DisplayName; this.numericUpDown.DecimalPlaces = 0; this.numericUpDown.Name = "numericUpDown"; this.numericUpDown.TextAlign = HorizontalAlignment.Right; this.numericUpDown.TabIndex = 1; this.slider.Name = "slider"; this.slider.AutoSize = false; this.slider.Orientation = Orientation.Horizontal; this.slider.TabIndex = 0; this.SliderShowTickMarks = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.SliderShowTickMarks].Value; this.resetButton.AutoSize = false; this.resetButton.Name = "resetButton"; this.resetButton.FlatStyle = FlatStyle.Standard; this.resetButton.Click += new EventHandler(ResetButton_Click); this.resetButton.Image = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference; this.resetButton.TabIndex = 2; this.resetButton.Visible = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value; this.ToolTip.SetToolTip(this.resetButton, PdnResources.GetString("Form.ResetButton.Text").Replace("&", "")); this.descriptionText.Name = "descriptionText"; this.descriptionText.AutoSize = false; this.descriptionText.Text = this.Description; // In order to make sure that setting the ranges on the controls doesn't affect the property in weird ways, // we don't set up our ValueChanged handlers until after we set up the controls. ValidateUIRanges(); ResetUIRanges(); this.numericUpDown.ValueChanged += new EventHandler(NumericUpDown_ValueChanged); this.slider.ValueChanged += new EventHandler(Slider_ValueChanged); Controls.AddRange( new Control[] { this.header, this.slider, this.numericUpDown, this.resetButton, this.descriptionText }); this.slider.EndInit(); ResumeLayout(false); }
public Int32ColorWheelPropertyControl(PropertyControlInfo propInfo) : base(propInfo) { if ((base.Property.MinValue != 0) || (base.Property.MaxValue != 0xffffff)) { object[] objArray1 = new object[] { "The only range allowed for this control is [", 0, ", ", 0xffffff, "]" }; throw new ArgumentException(string.Concat(objArray1)); } base.SuspendLayout(); this.header = new HeadingLabel(); this.header.Name = "header"; this.header.RightMargin = 0; this.header.Text = base.DisplayName; this.colorRectangle = new ColorRectangleControl(); this.colorRectangle.Name = "colorRectangle"; this.colorRectangle.TabStop = false; this.colorRectangle.TabIndex = 0; this.hsvColorWheel = new ColorWheel(); this.hsvColorWheel.Name = "hsvColorWheel"; this.hsvColorWheel.ColorChanged += new EventHandler(this.OnHsvColorWheelColorChanged); this.hsvColorWheel.TabStop = false; this.hsvColorWheel.TabIndex = 1; this.saturationSlider = new ColorGradientControl(); this.saturationSlider.Name = "saturationSlider"; this.saturationSlider.Orientation = Orientation.Vertical; this.saturationSlider.ValueChanged += new IndexEventHandler(this.OnSaturationSliderValueChanged); this.saturationSlider.TabStop = false; this.saturationSlider.TabIndex = 2; this.valueSlider = new ColorGradientControl(); this.valueSlider.Name = "valueSlider"; this.valueSlider.Orientation = Orientation.Vertical; this.valueSlider.ValueChanged += new IndexEventHandler(this.OnValueSliderValueChanged); this.valueSlider.TabStop = false; this.valueSlider.TabIndex = 3; this.redLabel = new PdnLabel(); this.redLabel.Name = "redLabel"; this.redLabel.AutoSize = true; this.redLabel.Text = PdnResources.GetString("ColorsForm.RedLabel.Text"); this.redNud = new PdnNumericUpDown(); this.redNud.Name = "redNud"; this.redNud.Minimum = decimal.Zero; this.redNud.Maximum = 255M; this.redNud.TextAlign = HorizontalAlignment.Right; this.redNud.ValueChanged += new EventHandler(this.OnRedNudValueChanged); this.redNud.TabIndex = 4; this.greenLabel = new PdnLabel(); this.greenLabel.Name = "greenLabel"; this.greenLabel.AutoSize = true; this.greenLabel.Text = PdnResources.GetString("ColorsForm.GreenLabel.Text"); this.greenNud = new PdnNumericUpDown(); this.greenNud.Name = "greenNud"; this.greenNud.Minimum = decimal.Zero; this.greenNud.Maximum = 255M; this.greenNud.TextAlign = HorizontalAlignment.Right; this.greenNud.ValueChanged += new EventHandler(this.OnGreenNudValueChanged); this.greenNud.TabIndex = 5; this.blueLabel = new PdnLabel(); this.blueLabel.Name = "blueLabel"; this.blueLabel.AutoSize = true; this.blueLabel.Text = PdnResources.GetString("ColorsForm.BlueLabel.Text"); this.blueNud = new PdnNumericUpDown(); this.blueNud.Name = "blueNud"; this.blueNud.Minimum = decimal.Zero; this.blueNud.Maximum = 255M; this.blueNud.TextAlign = HorizontalAlignment.Right; this.blueNud.ValueChanged += new EventHandler(this.OnBlueNudValueChanged); this.blueNud.TabIndex = 6; this.resetButton = new PdnPushButton(); this.resetButton.AutoSize = true; this.resetButton.Name = "resetButton"; this.resetButton.Click += new EventHandler(this.OnResetButtonClick); this.resetButton.Image = PdnResources.GetImage("Icons.ResetIcon.png"); this.resetButton.Width = 1; this.resetButton.Visible = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value; base.ToolTip.SetToolTip(this.resetButton, PdnResources.GetString("Form.ResetButton.Text").Replace("&", "")); this.resetButton.TabIndex = 7; this.description = new PdnLabel(); this.description.Name = "description"; this.description.Text = base.Description; Control[] controls = new Control[] { this.header, this.hsvColorWheel, this.saturationSlider, this.valueSlider, this.colorRectangle, this.redLabel, this.redNud, this.greenLabel, this.greenNud, this.blueLabel, this.blueNud, this.resetButton, this.description }; base.Controls.AddRange(controls); base.ResumeLayout(false); }
public VectorSliderPropertyControl(PropertyControlInfo propInfo) : base(propInfo) { SuspendLayout(); this.header = new HeaderLabel(); this.sliderX = new TrackBar(); this.numericUpDownX = new PdnNumericUpDown(); this.resetButtonX = new Button(); this.sliderY = new TrackBar(); this.numericUpDownY = new PdnNumericUpDown(); this.resetButtonY = new Button(); this.descriptionText = new Label(); this.header.Name = "header"; this.header.RightMargin = 0; this.header.Text = this.DisplayName; this.sliderX.Name = "sliderX"; this.sliderX.AutoSize = false; this.sliderX.ValueChanged += new EventHandler(SliderX_ValueChanged); this.sliderX.Orientation = Orientation.Horizontal; this.SliderShowTickMarksX = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.SliderShowTickMarksX].Value; this.numericUpDownX.Name = "numericUpDownX"; this.numericUpDownX.ValueChanged += new EventHandler(NumericUpDownX_ValueChanged); this.numericUpDownX.TextAlign = HorizontalAlignment.Right; this.resetButtonX.Name = "resetButtonX"; this.resetButtonX.AutoSize = false; this.resetButtonX.FlatStyle = FlatStyle.Standard; this.resetButtonX.Click += new EventHandler(ResetButtonX_Click); this.resetButtonX.Image = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference; this.resetButtonX.Visible = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value; this.ToolTip.SetToolTip(this.resetButtonX, PdnResources.GetString("Form.ResetButton.Text").Replace("&", "")); this.sliderY.Name = "sliderY"; this.sliderY.AutoSize = false; this.sliderY.ValueChanged += new EventHandler(SliderY_ValueChanged); this.sliderY.Orientation = Orientation.Horizontal; this.SliderShowTickMarksY = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.SliderShowTickMarksY].Value; this.numericUpDownY.Name = "numericUpDownY"; this.numericUpDownY.ValueChanged += new EventHandler(NumericUpDownY_ValueChanged); this.numericUpDownY.TextAlign = HorizontalAlignment.Right; this.resetButtonY.Name = "resetButtonY"; this.resetButtonY.AutoSize = false; this.resetButtonY.FlatStyle = FlatStyle.Standard; this.resetButtonY.Click += new EventHandler(ResetButtonY_Click); this.resetButtonY.Image = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference; this.resetButtonY.Visible = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value; this.ToolTip.SetToolTip(this.resetButtonY, PdnResources.GetString("Form.ResetButton.Text").Replace("&", "")); this.descriptionText.Name = "descriptionText"; this.descriptionText.AutoSize = false; this.descriptionText.Text = this.Description; ValidateUIRanges(); ResetUIRanges(); Controls.AddRange( new Control[] { this.header, this.sliderX, this.numericUpDownX, this.resetButtonX, this.sliderY, this.numericUpDownY, this.resetButtonY, this.descriptionText }); ResumeLayout(false); }