public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if ((context != null) && (provider != null))
            {
                // Access the Property Browser's UI display service
                IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (editorService != null)
                {
                    // Create an instance of the UI editor form
                    TextForm modalEditor = new TextForm();

                    // Pass the UI editor dialog the current property value
                    modalEditor.Behavior = value as TextBehavior;

                    // Display the UI editor dialog
                    if (editorService.ShowDialog(modalEditor) == DialogResult.OK)
                    {
                        // Return the new property value from the UI editor form
                        return modalEditor.Behavior;
                    }
                }
            }
            return base.EditValue(context, provider, value);
        }
Exemple #2
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if ((context != null) && (provider != null))
            {
                // Access the Property Browser's UI display service
                IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (editorService != null)
                {
                    // Create an instance of the UI editor form
                    TextForm modalEditor = new TextForm();

                    // Pass the UI editor dialog the current property value
                    modalEditor.Behavior = value as TextBehavior;

                    // Display the UI editor dialog
                    if (editorService.ShowDialog(modalEditor) == DialogResult.OK)
                    {
                        // Return the new property value from the UI editor form
                        return(modalEditor.Behavior);
                    }
                }
            }
            return(base.EditValue(context, provider, value));
        }