/// <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;

            PenForm form = new PenForm();
            form.SetPenData(value as PenData);
            wfes.DropDownControl(form);
            return form.GetPenData();
        }
Ejemplo n.º 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);
            }

            PenForm form = new PenForm();

            form.SetPenData(value as PenData);
            wfes.DropDownControl(form);
            return(form.GetPenData());
        }