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.