public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc == null) { return(value); } if (imageUI == null) { imageUI = new ImageIndexUI(); } InitializeImageList(context); imageUI.Start(edSvc, value, currentImageList); edSvc.DropDownControl(imageUI); value = imageUI.Value; imageUI.End(); } return(value); }
/// <summary> /// Edits the specified object's value using the editor style indicated by the <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"/> method. /// </summary> /// <returns> /// The new value of the object. If the value of the object has not changed, this should return the same object it was passed. /// </returns> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that can be used to gain additional context information. </param><param name="provider">An <see cref="T:System.IServiceProvider"/> that this editor can use to obtain services. </param><param name="value">The object to edit. </param> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider != null) { var edSvc = (IWindowsFormsEditorService) provider.GetService(typeof (IWindowsFormsEditorService)); if (edSvc == null) { return value; } if (imageUI == null) { imageUI = new ImageIndexUI(); } InitializeImageList(context); imageUI.Start(edSvc, value, currentImageList); edSvc.DropDownControl(imageUI); value = imageUI.Value; imageUI.End(); } return value; }