ImageList::ColorDepth Property
.NET Framework (current version)
Gets the color depth of the image list.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Property Value
Type: System.Windows.Forms::ColorDepthThe 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 | Condition |
|---|---|
| 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. When the handle for the ImageList has been created, 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.
.NET Framework
Available since 1.1
Available since 1.1
Show: