public void Add(Icon value) { if (value == null) { throw new ArgumentNullException("value"); } base.InnerList.Add(new ImageInfo(ImageListAdv.IconToImageAlphaCorrect(value), null)); }
public void Add(string key, Icon icon) { base.InnerList.Add(new ImageInfo(ImageListAdv.IconToImageAlphaCorrect(icon), key)); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { ArrayList arrayList = new ArrayList(); if (provider != null && (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)) != null) { if (fileDialog == null) { fileDialog = new OpenFileDialog(); fileDialog.Multiselect = true; string text = ImageEditor.CreateFilterEntry(this); for (int i = 0; i < imageExtenders.Length; i++) { ImageEditor imageEditor = (ImageEditor)Activator.CreateInstance(imageExtenders[i], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.CreateInstance, null, null, null); Type type = GetType(); Type type2 = imageEditor.GetType(); if (!type.Equals(type2) && imageEditor != null && type.IsInstanceOfType(imageEditor)) { text = text + "|" + ImageEditor.CreateFilterEntry(imageEditor); } } fileDialog.Filter = text; } IntPtr focus = NativeMethods.GetFocus(); try { if (fileDialog.ShowDialog() != DialogResult.OK) { return(arrayList); } string[] fileNames = fileDialog.FileNames; foreach (string text2 in fileNames) { bool flag = false; if (Path.GetExtension(text2) == ".ico") { try { Icon icon = new Icon(text2); arrayList.Add(ImageListAdv.IconToImageAlphaCorrect(icon)); flag = true; } catch (ArgumentException) { } } if (!flag) { FileStream stream = new FileStream(text2, FileMode.Open, FileAccess.Read, FileShare.Read); arrayList.Add(LoadFromStream(stream)); } } return(arrayList); } finally { if (focus != IntPtr.Zero) { NativeMethods.SetFocus(focus); } } } return(arrayList); }