DataGridViewCell.HasStyle 属性

定义

获取指示是否已设置 Style 属性的值。

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

属性值

如果已设置 Style 属性,则为 true;否则为 false

属性

注解

如果以前未访问过属性, Style 则获取 属性的值会自动实例化新的 DataGridViewCellStyle 。 因此,必须使用 HasStyle 属性来确定属性 Style 当前是否设置为 DataGridViewCellStyle 实例。 这可用于确定 属性 InheritedStyle 返回的 对象的哪些属性表示专门为单元格设置的样式。

有关单元格样式继承的详细信息,请参阅 Windows 窗体 DataGridView 控件中的单元格样式

适用于

另请参阅