The ImageList class has several built-in views that control how the items in the control are displayed. These views are contained in the ImageListViewStyle enumeration which is used with the ImageList.ViewStyle 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 ImageList.ViewStyle property of the ImageList class to ImageListViewStyle.Normal.
The following figure shows how the various item style properties affect how the items are displayed:
Legend Description1 | ImageList.ItemSize |
2 | ImageList.ItemImageSize |
3 | ImageList.ItemForeColor. Used to draw the text of un-selected items |
4 | ImageList.ItemBackColor. Used to fill the background of un-selected items |
5 | ImageList.ItemSelectedForeColor. Used to draw the text of selected items |
6 | ImageList.ItemSelectedBackColor. Used to fill the background of selected items |
Use the button view style by setting the ImageList.ViewStyle property of the ImageList class to ImageListViewStyle.Button.
The following figure shows how the various item style properties affect how the items are displayed:
Legend Description1 | ImageList.ItemSize |
2 | ImageList.ItemImageSize |
3 | ImageList.ItemSpacingSize |
4 | ImageList.ItemForeColor. Used to draw the text of all items (selected and un-selected) |
The following are not used with ImageListViewStyle.Button:
ImageList.ItemImageBorderStyle ImageList.ItemBackColor ImageList.ItemSelectedForeColor ImageList.ItemSelectedBackColor
Use the explorer view style by setting the ImageList.ViewStyle property of the ImageList class to ImageListViewStyle.Explorer.
The following figure shows how the various item style properties affect how the items are displayed:
Legend Description1 | ImageList.ItemSize |
2 | ImageList.ImageSize |
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 ImageListViewStyle.Explorer:
Owner-Draw View StyleUse the owner-draw view style by setting the ImageList.ViewStyle property of the ImageList class to ImageListViewStyle.OwnerDraw.
In owner-draw mode, the user can create a template using OwnerDrawStyleKey view style mode.