public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { if( value.GetType() != typeof(Color)) return value; // Uses the IWindowsFormsEditorService to display a // drop-down UI in the Properties window. IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if( edSvc != null ) { ColorEditorControl editor = new ColorEditorControl((Color)value); edSvc.DropDownControl( editor ); // Return the value in the appropraite data format. if( value.GetType() == typeof(Color) ) return editor.color; } return value; }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { if (value.GetType() != typeof(Color)) { return(value); } // Uses the IWindowsFormsEditorService to display a // drop-down UI in the Properties window. IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { ColorEditorControl editor = new ColorEditorControl((Color)value); edSvc.DropDownControl(editor); // Return the value in the appropraite data format. if (value.GetType() == typeof(Color)) { return(editor.color); } } return(value); }