Skip to main content

ImageList

WATCH & LEARN0:47 · Animated tutorial
7 scenesPlay, pause, or scrub at your own pace

The ImageList component is typically used by other controls, such as the ListView, TreeView, or ToolBar. You can add bitmaps or icons to the ImageList, and the other controls are able to use the images as they require.

The Wisej.NET ImageList component is used to store images, which can then be displayed by controls. An image list allows you to write code for a single, consistent catalog of images. For example, you can rotate images displayed by a Button control simply by changing the button's ImageIndex or ImageKey property. You can also associate the same image list with multiple controls. For example, if you are using both a ListView control and a TreeView control to display the same list of files, changing a file's icon in the image list will cause the new icon to appear in both views.

info

For a complete list of properties, methods, and events, see the API documentation.

Features​

Resizing​

When set, the ImageSize property will automatically force all images in the ImageSet to become the given size.

ImageList resizing demonstration

Transparent Color​

When set, the TransparentColor property specifies which color in the image should be treated as transparent.

Original Image:

Image before applying transparent color

How To​

Add images to the ImageList​

ImageList imageList1 = new ImageList();
imageList1.Images.Add("tree", Image.FromFile("tree.jpg"));
imageList1.Images.Add("apple", Image.FromFile("apple.png"));

In this code example, both tree.jpg and apple.png are located in the root folder of the project.