public static Color AskChooseColor(Color initColor) { using (ColorPickerForm f = new ColorPickerForm()) { f.TopMost = true; f.UpdateColors(initColor); f.ShowDialog(); return(f.GetCurrentColor()); } }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (value.GetType() != typeof(Color)) { return(value); } IWindowsFormsEditorService svc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (svc != null) { Color color = (Color)value; using (ColorPickerForm form = new ColorPickerForm(color)) { if (svc.ShowDialog(form) == DialogResult.OK) { return(form.GetCurrentColor().ARGB.ToColor()); } } } return(value); }