/// <summary>
        /// The user has asked to edit a value. Do it.
        /// </summary>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            // For future reference. When we are running within the IDE, IDesignerHost will be non-null, e.g.
            //IDesignerHost host = provider.GetService(typeof(IDesignerHost)) as IDesignerHost;

            // We need editor service otherwise we can't do anything
            IWindowsFormsEditorService wfes = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            if (wfes == null)
                return value;

            BrushForm form = new BrushForm();
            form.SetBrush(value as IBrushData);
            wfes.DropDownControl(form);
            return form.GetBrushData();
        }
Exemple #2
0
        /// <summary>
        /// The user has asked to edit a value. Do it.
        /// </summary>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            // For future reference. When we are running within the IDE, IDesignerHost will be non-null, e.g.
            //IDesignerHost host = provider.GetService(typeof(IDesignerHost)) as IDesignerHost;

            // We need editor service otherwise we can't do anything
            IWindowsFormsEditorService wfes = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

            if (wfes == null)
            {
                return(value);
            }

            BrushForm form = new BrushForm();

            form.SetBrush(value as IBrushData);
            wfes.DropDownControl(form);
            return(form.GetBrushData());
        }