public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (value.GetType() != typeof(GradientInfo)) { return value; } IWindowsFormsEditorService svc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (svc != null) { GradientInfo gradient = (GradientInfo)value; using (GradientPickerForm form = new GradientPickerForm(gradient.Copy())) { if (svc.ShowDialog(form) == DialogResult.OK) { return form.Gradient; } } } return value; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (value.GetType() != typeof(GradientInfo)) { return(value); } IWindowsFormsEditorService svc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (svc != null) { GradientInfo gradient = (GradientInfo)value; using (GradientPickerForm form = new GradientPickerForm(gradient.Copy())) { if (svc.ShowDialog(form) == DialogResult.OK) { return(form.Gradient); } } } return(value); }