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 static int GetGoodSliderTickFrequency(PdnTrackBar slider) { int num = Math.Abs((int)(slider.Maximum - slider.Minimum)); return(Math.Max(1, num / 20)); }