DataGridViewImageCell.ValueIsIcon 屬性

定義

取得或設定值,指出這個儲存格是否顯示 Icon 值。Gets or sets a value indicating whether this cell displays an Icon value.

public:
 property bool ValueIsIcon { bool get(); void set(bool value); };
public bool ValueIsIcon { get; set; }
member this.ValueIsIcon : bool with get, set
Public Property ValueIsIcon As Boolean

屬性值

如果這個儲存格顯示 Icon 值,則為 true,否則為 falsetrue if this cell displays an Icon value; otherwise, false.

備註

若要確保正確繪製Icon值的 Alpha 色板,請將此屬性設定為。 trueTo ensure that the alpha channel of Icon values is painted correctly, set this property to true. 當這個屬性為trueFormattedValueType ,和ValueType屬性Type會傳回代表類型的Icon物件。When this property is true, the FormattedValueType and ValueType properties return a Type object representing the Icon type.

設定 [擁有] 資料行的ValueIsIcon 屬性也會設定資料行中每個資料格的屬性,並重新整理資料行顯示。ValuesAreIconsSetting the ValuesAreIcons property of the owning column also sets the ValueIsIcon property of every cell in the column and refreshes the column display. 若要覆寫個別儲存格的指定值,請在設定資料行值之後設定儲存格值。To override the specified value for individual cells, set the cell values after you set the column value.

當這個屬性的值針對新記錄的資料列中的資料格進行變更時,顯示在資料格中的影像會更新為DefaultNewRowValue屬性的目前值。When the value of this property changes for a cell in the row for new records, the image displayed in the cell is updated to the current value of the DefaultNewRowValue property.

不同于資料ValuesAreIcons行屬性,當ValueIsIcon您變更其值時, NullValue資料格屬性不會自動更新相關聯儲存格樣式的屬性。Unlike the column ValuesAreIcons property, the cell ValueIsIcon property does not automatically update the NullValue property of the associated cell style when you change its value. 當您將資料格ValueIsIcon屬性值變更true為時,請務必將NullValue Style屬性所傳回之物件的屬性設為有效Icon的。When you change the cell ValueIsIcon property value to true, be sure to set the NullValue property of the object returned by the Style property to a valid Icon. 當您將ValueIsIcon屬性值變更為false時,請務必將NullValue屬性設定為有效Image的。When you change the ValueIsIcon property value to false, be sure to set the NullValue property to a valid Image.

適用於

另請參閱