Export (0) Print
Expand All

ListView.SmallImageList Property

Gets or sets the ImageList to use when displaying items as small icons in the control.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public function get SmallImageList () : ImageList 
public function set SmallImageList (value : ImageList)

Property Value

Type: System.Windows.Forms.ImageList
An ImageList that contains the icons to use when the View property is set to SmallIcon. The default is a null reference (Nothing in Visual Basic).

The SmallImageList property allows you to specify an ImageList object that contains icons to use when displaying items with small icons (when the View property is set to any value other than LargeIcon). The ListView control can accept any graphics format that the ImageList control supports when displaying icons. The ListView control is not limited to .ico files. Once an ImageList is assigned to the SmallImageList property, you can set the ImageIndex property of each ListViewItem in the ListView control to the index position of the appropriate image in the ImageList. The size of the icons for the SmallImageList is specified by the ImageSize property.

Because only one index can be specified for the ListViewItem.ImageIndex property, the ImageList objects specified in the LargeImageList and SmallImageList properties should have the same index positions for the images to display. For example, if the ImageIndex property of a ListViewItem is set to 0, the images to use for both small and large icons should be at the same index position in the ImageList objects specified in the LargeImageList and SmallImageList properties.

NoteNote:

When the images are specified with keys, you still need to place small and large versions of the image at the same index location in their respective image lists. When switching between views, the index location of the image in one list is used to locate the image in the other list, regardless of the key value specified.

To set the ImageList to use when displaying items with large icons (when the View property is set to LargeIcon), use the LargeImageList property. If you want to use images to display item state, use the StateImageList property.

The following code example creates a ListView control with three ListViewItem objects specified and three ListViewItem.ListViewSubItem objects specified for each item. The example also creates ColumnHeader objects to display the subitems in details view. Two ImageList objects are also created in the code example to provide images for the ListViewItem objects. These ImageList objects are added to the LargeImageList and SmallImageList properties. The example uses the following properties in creating the ListView control.

This example requires that you have added the code to a Form and call the method created in the example from the constructor or another method on the form. The example also requires that images named MySmallImage1, MySmallImage2, MyLargeImage1, and MyLargeImage2 are located in the root directory of drive C.

No code example is currently available or this language may not be supported.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft