Beispiel #1
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (value == null)
            {
                value = Hues.GetHue(0);
            }

            if (!(value is Hue hue))
            {
                return(value);
            }

            edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc == null)
            {
                return(value);
            }

            HuePickerControl huePickerControl = new HuePickerControl(hue);

            huePickerControl.ValueChanged += new HuePickerControl.ValueChangedEventHandler(ValueSelected);

            edSvc.DropDownControl(huePickerControl);
            if (ReturnValue != null)
            {
                huePickerControl.Dispose();
                return(ReturnValue);
            }
            huePickerControl.Dispose();
            return(value);
        }
Beispiel #2
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (value == null)
     {
         value = (object)Hues.GetHue(0);
     }
     if (value.GetType() == typeof(Hue))
     {
         this.edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (this.edSvc != null)
         {
             HuePickerControl huePickerControl = new HuePickerControl((Hue)value);
             huePickerControl.ValueChanged += new HuePickerControl.ValueChangedEventHandler(this.ValueSelected);
             this.edSvc.DropDownControl((Control)huePickerControl);
             if (this.ReturnValue != null)
             {
                 huePickerControl.Dispose();
                 return((object)this.ReturnValue);
             }
             huePickerControl.Dispose();
         }
     }
     return(value);
 }