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

屬性值

影像可用的色彩數。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.

備註

當您將色彩深度設定為新的值時,會重新建立影像清單的 HandleWhen you set the color depth to a new value, the Handle for the image list is recreated. 由於設定 ColorDepth 屬性會導致重新建立控制碼,因此您應該在設定 Images 屬性之前,先設定 ColorDepthBecause setting the ColorDepth property causes the handle to be recreated, you should set ColorDepth prior to setting the Images property. 建立 ImageList 的控制碼之後,在程式碼中設定 ColorDepthImageSize 屬性,在設定 Images 屬性之後,將會導致已為 Images 屬性設定的影像集合遭到刪除。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.

適用於

另請參閱