The ImageList class has several built-in views that control how the items in the control are displayed. These views are contained in the ImageListItemStyle enumeration which is used with the ItemStyle property.
The following figures show the various properties that control how the ImageList views its items.
Normal View StyleUse the normal view style by setting the ItemStyle property of the ImageList class to ImageListItemStyle.Normal.
The following figure shows how the various item style properties affect how the items are displayed:
Legend Description1 | ImageList.ItemSize |
2 | ItemImageSize |
3 | ImageList.ItemForeground. Used to draw the text of un-selected items |
4 | ImageList.ItemBackground. Used to fill the background of un-selected items |
5 | ImageList.ItemSelectedForeground. Used to draw the text of selected items |
6 | ImageList.ItemSelectedBackground. Used to fill the background of selected items |
Use the button view style by setting the ItemStyle property of the ImageList class to ImageListItemStyle.Button.
The following figure shows how the various item style properties affect how the items are displayed:
Legend Description1 | ImageList.ItemSize |
2 | ItemImageSize |
3 | ImageList.ItemMargin |
4 | ImageList.ItemForeground. Used to draw the text of all items (selected and un-selected) |
The following are not used with ImageListItemStyle.Button:
Use the explorer view style by setting the ItemStyle property of the ImageList class to ImageListItemStyle.Explorer.
The following figure shows how the various item style properties affect how the items are displayed:
Legend Description1 | ImageList.ItemSize |
2 | ItemImageSize |
3 | ImageList.ItemMargin |
4 | ImageList.ItemForeground. Used to draw the text of un-selected items |
5 | ImageList.ItemSelectedForeground. Used to draw the text of selected items as well as a rectangle around the image of selected items |
6 | ImageList.ItemSelectedBackground. When an item is selected, this color is used to fill the background behind the text of the item and to draw a rectangle around the image |
The following are not used with ImageListItemStyle.Explorer:
Owner-Draw View StyleUse the owner-draw view style by setting the ItemStyle property of the ImageList class to ImageListItemStyle.UserStyle.