Edit

Share via


ImageList.ColorDepth Property

Definition

Gets or sets the color depth of the image list.

public:
 property System::Windows::Forms::ColorDepth ColorDepth { System::Windows::Forms::ColorDepth get(); void set(System::Windows::Forms::ColorDepth value); };
public System.Windows.Forms.ColorDepth ColorDepth { get; set; }
member this.ColorDepth : System.Windows.Forms.ColorDepth with get, set
Public Property ColorDepth As ColorDepth

Property Value

The number of available colors for the image. In .NET Framework and .NET (Core) versions through .NET 7, the default is Depth8Bit. In .NET 8 and later versions, the default is Depth32Bit.

Exceptions

The color depth is not a valid ColorDepth enumeration value.

Remarks

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.

Applies to

See also