Inheritance: System.Windows.Forms.Form
Exemplo n.º 1
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                if (edSvc != null)
                {
                    if (_editorUI == null)
                    {
                        _editorUI = new XSharpSLEPropertyForm();
                    }

                    _editorUI.Text = context.PropertyDescriptor.DisplayName; // we can also use the Attributes property to pass in information via an attribute
                    _editorUI.PropertyText.Text = (string)value;
                    _editorUI.PropertyText.Select();
                    _editorUI.PropertyText.DeselectAll();
                    _editorUI.PropertyText.ClearUndo();

                    XBuildMacroCollection mc = new XBuildMacroCollection((ProjectNode)((SettingsPage)context.Instance).ProjectMgr);
                    _editorUI.SetMacros(mc);

                    DialogResult result = edSvc.ShowDialog(_editorUI);

                    if (result == DialogResult.OK)
                    {
                        value = _editorUI.PropertyText.Text;
                    }
                }
            }

            return(value);
        }
Exemplo n.º 2
0
      public override object EditValue( ITypeDescriptorContext context, IServiceProvider provider, object value )
      {
         if ( provider != null )
         {
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService) provider.GetService( typeof( IWindowsFormsEditorService ) );

            if ( edSvc != null )
            {
               if ( _editorUI == null )
               {
                  _editorUI = new XSharpSLEPropertyForm();
               }

               _editorUI.Text = context.PropertyDescriptor.DisplayName;  // we can also use the Attributes property to pass in information via an attribute
               _editorUI.PropertyText.Text = (string) value;
               _editorUI.PropertyText.Select();
               _editorUI.PropertyText.DeselectAll();
               _editorUI.PropertyText.ClearUndo();

               XSharpBuildMacros mc = new XSharpBuildMacros( (ProjectNode) ( (SettingsPage) context.Instance ).ProjectMgr );
               _editorUI.SetMacros( mc );

               DialogResult result = edSvc.ShowDialog( _editorUI );

               if ( result == DialogResult.OK )
               {
                  value = _editorUI.PropertyText.Text;
               }
            }
         }

         return value;
      }