Exemplo n.º 1
0
        /// <summary>
        /// Edits the given value.
        /// </summary>
        /// <param name="context">Context infromation.</param>
        /// <param name="provider">Service provider.</param>
        /// <param name="value">Value to be edited.</param>
        /// <returns>An edited value.</returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (service == null)
                {
                    return(value);
                }

                if (_colorUI == null)
                {
                    _colorUI = new ColorUIWrapper(this, service);
                }

                _colorUI.Start(service, value);
                service.DropDownControl(_colorUI.Control);
                if ((_colorUI.Value != null) && (((Color)_colorUI.Value) != Color.Empty))
                {
                    value = _colorUI.Value;
                }
                _colorUI.End();
            }
            return(value);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Edits the given value.
        /// </summary>
        /// <param name="context">Context infromation.</param>
        /// <param name="provider">Service provider.</param>
        /// <param name="value">Value to be edited.</param>
        /// <returns>An edited value.</returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (service == null)
                {
                    return(value);
                }

                if (_colorUI == null)
                {
                    _colorUI = new ColorUIWrapper(this);
                }

                Color xnacolor = (Color)value;
                _colorUI.Start(service, System.Drawing.Color.FromArgb(xnacolor.A, xnacolor.R, xnacolor.G, xnacolor.B));

                service.DropDownControl(_colorUI.Control);
                if ((_colorUI.Value != null) /*&& (((Color)_colorUI.Value) != Color.Empty)*/)
                {
                    //value = _colorUI.Value;
                    System.Drawing.Color rescolor = (System.Drawing.Color)_colorUI.Value;
                    value = new Color(rescolor.R, rescolor.G, rescolor.B, rescolor.A);
                }
                _colorUI.End();
            }
            return(value);
        }
        /// <summary>
        /// Edits the given value.
        /// </summary>
        /// <param name="context">Context infromation.</param>
        /// <param name="provider">Service provider.</param>
        /// <param name="value">Value to be edited.</param>
        /// <returns>An edited value.</returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (service == null)
                    return value;

                if (_colorUI == null)
                    _colorUI = new ColorUIWrapper(this, service);

                _colorUI.Start(service, value);
                service.DropDownControl(_colorUI.Control);
                if ((_colorUI.Value != null) && (((Color)_colorUI.Value) != Color.Empty))
                {
                    value = _colorUI.Value;
                }
                _colorUI.End();
            }
            return value;
        }
        /// <summary>
        /// Edits the given value.
        /// </summary>
        /// <param name="context">Context infromation.</param>
        /// <param name="provider">Service provider.</param>
        /// <param name="value">Value to be edited.</param>
        /// <returns>An edited value.</returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (service == null) return value;

                if (_colorUI == null) _colorUI = new ColorUIWrapper(this);

                Color xnacolor = (Color)value;
                _colorUI.Start(service, System.Drawing.Color.FromArgb(xnacolor.A, xnacolor.R, xnacolor.G, xnacolor.B));

                service.DropDownControl(_colorUI.Control);
                if ((_colorUI.Value != null) /*&& (((Color)_colorUI.Value) != Color.Empty)*/)
                {
                    //value = _colorUI.Value;
                    System.Drawing.Color rescolor = (System.Drawing.Color)_colorUI.Value;
                    value = new Color(rescolor.R, rescolor.G, rescolor.B, rescolor.A);
                }
                _colorUI.End();
            }
            return value;
        }