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 傳回之物件的哪些屬性代表特別針對儲存格所設定的樣式。

如需儲存格樣式繼承的詳細資訊,請參閱DataGridView 控制項中的儲存格樣式Windows Forms

適用於

另請參閱