DataGridViewBand.HasDefaultCellStyle 屬性

定義

取得指出是否已經設定 DefaultCellStyle 屬性的值。Gets a value indicating whether the DefaultCellStyle property has been set.

public:
 property bool HasDefaultCellStyle { bool get(); };
[System.ComponentModel.Browsable(false)]
public bool HasDefaultCellStyle { get; }
[<System.ComponentModel.Browsable(false)>]
member this.HasDefaultCellStyle : bool
Public ReadOnly Property HasDefaultCellStyle As Boolean

屬性值

Boolean

如果 DefaultCellStyle 屬性已經設定,則為 true,否則為 falsetrue if the DefaultCellStyle property has been set; otherwise, false.

屬性

備註

DefaultCellStyle DataGridViewCellStyle 如果先前未存取屬性,取得屬性值會自動具現化新的。Getting the value of the DefaultCellStyle property automatically instantiates a new DataGridViewCellStyle if the property has not previously been accessed. 因此,您必須使用 HasDefaultCellStyle 屬性來判斷 DefaultCellStyle 屬性目前是否設定為 DataGridViewCellStyle 實例。You must, therefore, use the HasDefaultCellStyle property to determine whether the DefaultCellStyle property is currently set to a DataGridViewCellStyle instance. 這很適合用來判斷屬性所傳回之物件的哪些屬性 InheritedStyle 代表專門針對該波段設定的樣式。This is useful to determine which properties of the object returned by the InheritedStyle property represent styles set specifically for the band.

如需資料格樣式繼承的詳細資訊,請參閱 Windows Forms DataGridView 控制項中的儲存格樣式For more information about cell style inheritance, see Cell Styles in the Windows Forms DataGridView Control.

適用於

另請參閱