DataGridViewBand.HasDefaultCellStyle DataGridViewBand.HasDefaultCellStyle DataGridViewBand.HasDefaultCellStyle DataGridViewBand.HasDefaultCellStyle Property


获取指示是否已设置 DefaultCellStyle 属性的值。Gets a value indicating whether the DefaultCellStyle property has been set.

 property bool HasDefaultCellStyle { bool get(); };
public bool HasDefaultCellStyle { get; }
member this.HasDefaultCellStyle : bool
Public ReadOnly Property HasDefaultCellStyle As 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 窗体 DataGridView 控件中的单元格样式For more information about cell style inheritance, see Cell Styles in the Windows Forms DataGridView Control.