Esempio n. 1
0
        /// <summary> Opens the string editor. </summary>
        /// <returns></returns>
        protected override IQOpResult <double> OpenEditor(double defaultValue, IQVarElementTarget target)
        {
            var editor = new DoubleValueEditor
            {
                //If a single select custom value is set, load that value.
                Value    = defaultValue,
                MinValue = MinValue,
                MaxValue = MaxValue
            };

            return((editor.ShowDialog() == DialogResult.OK)
                       ? new IQOpResult <double> {
                Result = OpResultEnum.Completed, Value = editor.Value
            }
                       : new IQOpResult <double> {
                Result = OpResultEnum.Cancelled
            });
        }
Esempio n. 2
0
        public override IPropertyValueEditor CreateEditor(System.ComponentModel.PropertyDescriptor propertyDescriptor, object targetObject)
        {
            if (propertyDescriptor.PropertyType != typeof(double) && propertyDescriptor.PropertyType != typeof(double?))
                throw new InvalidOperationException("PropertyDateTimeEditor works only with double type properties");

            DoubleValueEditor editor = new DoubleValueEditor();
            editor.AutoBorderSize = 1;

            if (!string.IsNullOrEmpty(DisplayFormat))
            {
                editor.DisplayFormat = DisplayFormat;
            }
            editor.ShowUpDown = ShowUpDownButton;
            editor.Height = 14;
            editor.BackgroundStyle.Class = "";
            editor.BackgroundStyle.BackColor = Color.White;
            editor.MinValue = MinValue;
            editor.MaxValue = MaxValue;
            editor.AllowEmptyState = AllowEmptyState;
            return editor;
        }