BrightIdeasSoftware.ObjectListView.MakeResizedImageList C# (CSharp) Method

MakeResizedImageList() private method

Return a copy of the given source image list, where each image has been resized to be height x height in size. If source is null, an empty image list of the given size is returned
private MakeResizedImageList ( int width, int height, ImageList source ) : ImageList
width int Height and width of the new images
height int Height and width of the new images
source ImageList Source of the images (can be null)
return ImageList
        private ImageList MakeResizedImageList(int width, int height, ImageList source)
        {
            ImageList il = new ImageList();
            il.ImageSize = new Size(width, height);
            il.ColorDepth = ColorDepth.Depth32Bit;

            // If there's nothing to copy, just return the new list
            if (source == null)
                return il;

            il.TransparentColor = source.TransparentColor;
            il.ColorDepth = source.ColorDepth;

            // Fill the imagelist with resized copies from the source
            for (int i = 0; i < source.Images.Count; i++) {
                Bitmap bm = this.MakeResizedImage(width, height, source.Images[i], source.TransparentColor);
                il.Images.Add(bm);
            }

            // Give each image the same key it has in the original
            foreach (String key in source.Images.Keys) {
                il.Images.SetKeyName(source.Images.IndexOfKey(key), key);
            }

            return il;
        }
ObjectListView