protected override void CloneProperties(FlexibleProperty flexProp) { FlexiblePropertyInteger prop = (FlexiblePropertyInteger)flexProp; prop._min = _min; prop._max = _max; prop._definitionName = _definitionName; prop._definitionMember = _definitionMember; base.CloneProperties(flexProp); }
public override void SetProperty(DesignerPropertyInfo property, object obj) { base.SetProperty(property, obj); DesignerFlexibleFloat flexFloatAtt = property.Attribute as DesignerFlexibleFloat; if (flexFloatAtt != null) { minNumericUpDown.DecimalPlaces = flexFloatAtt.Precision; minNumericUpDown.Minimum = (decimal)flexFloatAtt.Min; minNumericUpDown.Maximum = (decimal)flexFloatAtt.Max; minNumericUpDown.Increment = (decimal)flexFloatAtt.Steps; maxNumericUpDown.DecimalPlaces = flexFloatAtt.Precision; maxNumericUpDown.Minimum = (decimal)flexFloatAtt.Min; maxNumericUpDown.Maximum = (decimal)flexFloatAtt.Max; maxNumericUpDown.Increment = (decimal)flexFloatAtt.Steps; FlexiblePropertyFloat flexProp = (FlexiblePropertyFloat)property.Property.GetValue(obj, null); minNumericUpDown.Value = (decimal)flexProp.Min; maxNumericUpDown.Value = (decimal)flexProp.Max; unitLabel.Text = flexFloatAtt.Units; } DesignerFlexibleInteger flexIntegerAtt = property.Attribute as DesignerFlexibleInteger; if (flexIntegerAtt != null) { minNumericUpDown.DecimalPlaces = 0; minNumericUpDown.Minimum = (decimal)flexIntegerAtt.Min; minNumericUpDown.Maximum = (decimal)flexIntegerAtt.Max; minNumericUpDown.Increment = (decimal)flexIntegerAtt.Steps; maxNumericUpDown.DecimalPlaces = 0; maxNumericUpDown.Minimum = (decimal)flexIntegerAtt.Min; maxNumericUpDown.Maximum = (decimal)flexIntegerAtt.Max; maxNumericUpDown.Increment = (decimal)flexIntegerAtt.Steps; FlexiblePropertyInteger flexProp = (FlexiblePropertyInteger)property.Property.GetValue(obj, null); minNumericUpDown.Value = (decimal)flexProp.Min; maxNumericUpDown.Value = (decimal)flexProp.Max; unitLabel.Text = flexIntegerAtt.Units; } }
private void ValueChanged() { if (_property.Attribute is DesignerFlexibleFloat) { FlexiblePropertyFloat flexProp = (FlexiblePropertyFloat)_property.Property.GetValue(_object, null); flexProp.Min = (float)minNumericUpDown.Value; flexProp.Max = (float)maxNumericUpDown.Value; } if (_property.Attribute is DesignerFlexibleInteger) { FlexiblePropertyInteger flexProp = (FlexiblePropertyInteger)_property.Property.GetValue(_object, null); flexProp.Min = (int)minNumericUpDown.Value; flexProp.Max = (int)maxNumericUpDown.Value; } OnValueChanged(); }