1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- 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<System.Windows.Media.ImageSource> 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);
- }
- }
- }
- }
|