///<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>
        ///
        ///<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>
        ///
        ///<param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that can be used to gain additional context information. </param>
        ///<param name="value">The object to edit. </param>
        ///<param name="provider">An <see cref="T:System.IServiceProvider"></see> that this editor can use to obtain services. </param>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService editorService;
            GradientEditorUI           editor;

            if (context != null && context.Instance != null && provider != null)
            {
                editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (!(value is int && (int)value < 360 && (int)value >= 0))
                {
                    value = 0;
                }
                if (editorService != null)
                {
                    var currentValue = (int)value;
                    editor = new GradientEditorUI(currentValue)
                    {
                        Dock = DockStyle.Fill
                    };
                    editorService.DropDownControl(editor);
                    value = editor.GetValue();
                }
            }

            return(value);
        }
        ///<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>
        ///
        ///<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>
        ///
        ///<param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that can be used to gain additional context information. </param>
        ///<param name="value">The object to edit. </param>
        ///<param name="provider">An <see cref="T:System.IServiceProvider"></see> that this editor can use to obtain services. </param>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService editorService;
            GradientEditorUI editor;

            if (context != null && context.Instance != null && provider != null)
            {
                editorService = (IWindowsFormsEditorService) provider.GetService(typeof (IWindowsFormsEditorService));
                if (!(value is int && (int) value < 360 && (int) value >= 0))
                {
                    value = 0;
                }
                if (editorService != null)
                {
                    var currentValue = (int) value;
                    editor = new GradientEditorUI(currentValue) {Dock = DockStyle.Fill};
                    editorService.DropDownControl(editor);
                    value = editor.GetValue();
                }
            }

            return value;
        }