The RasterImageList class has several built-in views that control how the items in the control are displayed. These views are contained in the RasterImageListViewStyle enumeration which is used with the RasterImageList.ViewStyle property.
The following figures show the various properties that control how the RasterImageList views its items.
Normal View StyleUse the normal view style by setting the RasterImageList.ViewStyle property of the RasterImageList class to RasterImageListViewStyle.Normal.
The following figure shows how the various item style properties affect how the items are displayed:
Legend Description1 | RasterImageList.ItemSize |
2 | RasterImageList.ItemImageSize |
3 | RasterImageList.ItemSpacingSize |
4 | RasterImageList.ItemBorderStyle |
5 | RasterImageList.ItemImageBorderStyle |
6 | RasterImageList.ItemForeColor. Used to draw the text of un-selected items |
7 | RasterImageList.ItemBackColor. Used to fill the background of un-selected items |
8 | RasterImageList.ItemSelectedForeColor. Used to draw the text of selected items |
9 | RasterImageList.ItemSelectedBackColor. Used to fill the background of selected items |
Use the button view style by setting the RasterImageList.ViewStyle property of the RasterImageList class to RasterImageListViewStyle.Button.
The following figure shows how the various item style properties affect how the items are displayed:
Legend Description1 | RasterImageList.ItemSize |
2 | RasterImageList.ItemImageSize |
3 | RasterImageList.ItemSpacingSize |
4 | RasterImageList.ItemForeColor. Used to draw the text of all items (selected and un-selected) |
The following are not used with RasterImageListViewStyle.Button:
Use the explorer view style by setting the RasterImageList.ViewStyle property of the RasterImageList class to RasterImageListViewStyle.Explorer.
The following figure shows how the various item style properties affect how the items are displayed:
Legend Description1 | RasterImageList.ItemSize |
2 | RasterImageList.ItemImageSize |
3 | RasterImageList.ItemSpacingSize |
4 | RasterImageList.ItemForeColor. Used to draw the text of un-selected items |
5 | RasterImageList.ItemSelectedForeColor. Used to draw the text of selected items as well as a rectangle around the image of selected items |
6 | RasterImageList.ItemSelectedBackColor. 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 RasterImageListViewStyle.Explorer:
Owner-Draw View StyleUse the owner-draw view style by setting the RasterImageList.ViewStyle property of the RasterImageList class to RasterImageListViewStyle.OwnerDraw.
In owner-draw mode, the control will not draw any items by default. Instead it will raise the RasterImageList.DrawItem event and you are responsible for drawing the items yourself. Refer to the RasterImageList.DrawItem event for an example of how to use the owner-draw view style mode.