Exemple #1
0
        /// <summary>
        ///  Edits the given object value using the editor style provided by ShortcutKeysEditor.GetEditStyle.
        /// </summary>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider is null)
            {
                return(value);
            }

            if (!(provider.GetService(typeof(IWindowsFormsEditorService)) is IWindowsFormsEditorService edSvc))
            {
                return(value);
            }

            if (_shortcutKeysUI is null)
            {
                _shortcutKeysUI = new ShortcutKeysUI(this)
                {
                    BackColor = SystemColors.Control
                };
            }

            _shortcutKeysUI.Start(edSvc, value);
            edSvc.DropDownControl(_shortcutKeysUI);

            if (_shortcutKeysUI.Value != null)
            {
                value = _shortcutKeysUI.Value;
            }

            _shortcutKeysUI.End();
            return(value);
        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (provider != null)
     {
         IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService));
         if (edSvc == null)
         {
             return value;
         }
         if (this.shortcutKeysUI == null)
         {
             this.shortcutKeysUI = new ShortcutKeysUI(this);
             IUIService service = provider.GetService(typeof(IUIService)) as IUIService;
             if ((service != null) && (service.Styles["VsColorPanelText"] is Color))
             {
                 this.shortcutKeysUI.ForeColor = (Color) service.Styles["VsColorPanelText"];
             }
         }
         this.shortcutKeysUI.Start(edSvc, value);
         edSvc.DropDownControl(this.shortcutKeysUI);
         if (this.shortcutKeysUI.Value != null)
         {
             value = this.shortcutKeysUI.Value;
         }
         this.shortcutKeysUI.End();
     }
     return value;
 }
Exemple #3
0
        /// <summary>
        ///     Edits the given object value using the editor style provided by ShortcutKeysEditor.GetEditStyle.
        /// </summary>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                IWindowsFormsEditorService edSvc =
                    (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (edSvc != null)
                {
                    if (shortcutKeysUI == null)
                    {
                        shortcutKeysUI           = new ShortcutKeysUI(this);
                        shortcutKeysUI.BackColor = SystemColors.Control;
                    }

                    shortcutKeysUI.Start(edSvc, value);
                    edSvc.DropDownControl(shortcutKeysUI);

                    if (shortcutKeysUI.Value != null)
                    {
                        value = shortcutKeysUI.Value;
                    }
                    shortcutKeysUI.End();
                }
            }

            return(value);
        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (provider != null)
     {
         IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService));
         if (edSvc == null)
         {
             return value;
         }
         if (this.shortcutKeysUI == null)
         {
             this.shortcutKeysUI = new ShortcutKeysUI(this);
         }
         this.shortcutKeysUI.Start(edSvc, value);
         edSvc.DropDownControl(this.shortcutKeysUI);
         if (this.shortcutKeysUI.Value != null)
         {
             value = this.shortcutKeysUI.Value;
         }
         this.shortcutKeysUI.End();
     }
     return value;
 }