Esempio n. 1
0
        /// <summary>
        /// Edits the specified object's value using the editor style indicated by the <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"></see> method</summary>
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that can be used to gain additional context information</param>
        /// <param name="provider">An <see cref="T:System.IServiceProvider"></see> that this editor can use to obtain services</param>
        /// <param name="value">The object to edit</param>
        /// <returns>The new value of the object. If the value of the object has not changed, this should return the same object it was passed.</returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService editorService =
                provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

            if (editorService != null)
            {
                Sce.Atf.Controls.NumericTupleControl control =
                    new Sce.Atf.Controls.NumericTupleControl(m_numericType, m_names);
                control.HideAxisLabel = HideAxisLabel;
                control.SetLabelBackColors(m_labelColors);
                if (value != null)
                {
                    control.Value = value;
                }

                editorService.DropDownControl(control);
                value = control.LastEdit; // kind of tricky way to ensure that we don't create a new object with the same value
            }

            return(value);
        }
Esempio n. 2
0
        /// <summary>
        /// Edits the specified object's value using the editor style indicated by the <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"></see> method</summary>
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that can be used to gain additional context information</param>
        /// <param name="provider">An <see cref="T:System.IServiceProvider"></see> that this editor can use to obtain services</param>
        /// <param name="value">The object to edit</param>
        /// <returns>The new value of the object. If the value of the object has not changed, this should return the same object it was passed.</returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService editorService =
                provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

            if (editorService != null)
            {
                Sce.Atf.Controls.NumericTupleControl control =
                    new Sce.Atf.Controls.NumericTupleControl(m_numericType, m_names);
                control.HideAxisLabel = HideAxisLabel;
                control.SetLabelBackColors(m_labelColors);
                if (value != null)
                    control.Value = value;

                editorService.DropDownControl(control);
                value = control.LastEdit; // kind of tricky way to ensure that we don't create a new object with the same value
            }

            return value;
        }