using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing.Design; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using DPumpHydr.WinFrmUI.WenSkin.Controls; namespace DPumpHydr.WinFrmUI.WenSkin.Design.Editor { public class WenDataGridViewComboBoxCollectionEditor : WenCollectionEditor { public WenDataGridViewComboBoxCollectionEditor(Type type) : base(type) { } public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (value is WenDataGridViewComboBoxColumn.ObjectCollection items) { string str = ""; foreach (var item in items) { str += item?.ToString() + "\r\n"; } if (str.Length > 2) str.Remove(str.Length - 2, 2); var picker = new EditForm.MultilineTextEditForm(str); if (picker.ShowDialog() == DialogResult.OK) { items.Clear(); items.AddRange(picker.Message.Replace("\r", "").Split('\n')); MessageBox.Show(items.Count.ToString()); return items; } } return value; } public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) { return UITypeEditorEditStyle.Modal; } } }