Ejemplo n.º 1
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService editorServer = null;

            if (context != null && context.Instance != null && provider != null)
            {
                editorServer = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
                if (editorServer != null)
                {
                    MyListControl control = context.Instance as MyListControl;
                    ScopeAttributeEditorControl editorControl = new ScopeAttributeEditorControl(control.Scope);
                    editorServer.DropDownControl(editorControl);
                    value = editorControl.Scope;
                    return(value);
                }
            }
            return(base.EditValue(context, provider, value));
        }
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService editorService = null;

            if (context != null && context.Instance != null && provider != null)
            {
                editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (editorService != null)
                {
                    MyListControl            control = context.Instance as MyListControl;
                    ScopeAttributeEditDialog dlg     = new ScopeAttributeEditDialog(control.Scope);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        value = dlg.Scope;
                        return(value);
                    }
                }
            }

            return(base.EditValue(context, provider, value));
        }