ImageList.ColorDepth 属性

定义

获取图像列表的颜色深度。Gets 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

属性值

ColorDepth

图像的可用颜色数。The number of available colors for the image. 在 .NET Framework 1.0 版本中,默认值为 Depth4BitIn the .NET Framework version 1.0, the default is Depth4Bit. 在 .NET Framework 1.1 或更高版本中,默认值为 Depth8BitIn the .NET Framework version 1.1 or later, the default is Depth8Bit.

例外

颜色深度不是有效的 ColorDepth 枚举值。The color depth is not a valid ColorDepth enumeration value.

注解

将颜色深度设置为新值时,将 Handle 重新创建图像列表的。When you set the color depth to a new value, the Handle for the image list is recreated. 由于设置 ColorDepth 属性将导致重新创建句柄,因此应在 ColorDepth 设置属性之前设置 ImagesBecause setting the ColorDepth property causes the handle to be recreated, you should set ColorDepth prior to setting the Images property. 如果已创建的句柄 ImageList ,则 ColorDepth ImageSize 在代码中设置或属性后,在设置属性后, Images 将导致为要删除的属性设置的图像集合 ImagesWhen 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.

适用于

另请参阅