Export (0) Print
Expand All

ImageList Class

Provides methods to manage a collection of Image objects. This class cannot be inherited.

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

type ImageList =  
        inherit Component 

The ImageList type exposes the following members.

Public methodImageList()Initializes a new instance of the ImageList class with default values for ColorDepth, ImageSize, and TransparentColor.
Public methodImageList(IContainer)Initializes a new instance of the ImageList class, associating it with a container.

Public propertyColorDepthGets the color depth of the image list.
Public propertyContainerGets the IContainer that contains the Component. (Inherited from Component.)
Public propertyHandleGets the handle of the image list object.
Public propertyHandleCreatedGets a value indicating whether the underlying Win32 handle has been created.
Public propertyImagesGets the ImageList.ImageCollection for this image list.
Public propertyImageSizeGets or sets the size of the images in the image list.
Public propertyImageStreamGets the ImageListStreamer associated with this image list.
Public propertySiteGets or sets the ISite of the Component. (Inherited from Component.)
Public propertyTagGets or sets an object that contains additional data about the ImageList.
Public propertyTransparentColorGets or sets the color to treat as transparent.

Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public methodDispose()Releases all resources used by the Component. (Inherited from Component.)
Public methodDraw(Graphics, Point, Int32)Draws the image indicated by the specified index on the specified Graphics at the given location.
Public methodDraw(Graphics, Int32, Int32, Int32)Draws the image indicated by the given index on the specified Graphics at the specified location.
Public methodDraw(Graphics, Int32, Int32, Int32, Int32, Int32)Draws the image indicated by the given index on the specified Graphics using the specified location and size.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodToStringInfrastructure. Returns a string that represents the current ImageList. (Overrides Component.ToString().)

Public eventDisposedOccurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)
Public eventRecreateHandleOccurs when the Handle is recreated.

ImageList 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.

ImageList uses a handle to manage the list of images. The Handle is not created until certain operations, such as getting the Handle or calling Draw, are performed on the image list. Performing other operations, such as setting the ColorDepth or ImageSize will cause the Handle to be recreated. Therefore, you should perform these operations before you add images to the ImageList. In addition, when you work with forms that will be localized, you should always add an ImageList and images when the Language property of a form is set to Default. Changing the form's language before you add images will corrupt the application resource files.

The following code example shows how to select, remove, and display images.

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

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2014 Microsoft