This documentation is archived and is not being maintained.

ImageList.ColorDepth Property

Gets the color depth of the image list.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public ColorDepth ColorDepth { get; set; }
/** @property */
public ColorDepth get_ColorDepth ()

/** @property */
public void set_ColorDepth (ColorDepth value)

public function get ColorDepth () : ColorDepth

public function set ColorDepth (value : ColorDepth)

Property Value

The number of available colors for the image. In the .NET Framework version 1.0, the default is Depth4Bit. In the .NET Framework version 1.1 or later, the default is Depth8Bit.

Exception typeCondition

InvalidEnumArgumentException

The color depth is not a valid ColorDepth enumeration value.

When you set the color depth to a new value, the Handle for the image list is recreated.

Because setting the ColorDepth property causes the handle to be recreated, you should set ColorDepth prior to setting the Images property. Setting the ColorDepth or ImageSize properties in code, after setting the Images property, will cause the collection of images set for the Images property to be deleted.

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

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

.NET Framework

Supported in: 2.0, 1.1, 1.0
Show: