using System.Collections; using System.Collections.Generic; using System.Drawing; namespace System.Windows.Forms { public class ImageList : IDisposable { public ImageCollection Images { get; } public ColorDepth ColorDepth { get; set; } // TODO? always 32bpp public System.Drawing.Size ImageSize { get; set; } // TODO? public void Dispose() { } public ImageList() { Images = new(); } public class ImageCollection : CollectionBase { internal List ImageSources { get; } = new(); public Image this[int index] => (index < 0 || index >= Count) ? null : List[index] as Image; public void Add(Image value, Color transparentColor) { // TODO: transparent color? we don't use it List.Add(value); ImageSources.Add(Helper.GetImage(value)); } public void Add(Image value) => Add(value, Color.Transparent); public new void Clear() { List.Clear(); ImageSources.Clear(); } public new void RemoveAt(int index) { List.RemoveAt(index); ImageSources.RemoveAt(index); } } } }